Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the xAxis to use the values from my dataset #1791

Closed
sanjay2001 opened this issue Nov 4, 2016 · 3 comments
Closed

Fix the xAxis to use the values from my dataset #1791

sanjay2001 opened this issue Nov 4, 2016 · 3 comments

Comments

@sanjay2001
Copy link

sanjay2001 commented Nov 4, 2016

I am unable to set the axis values to be the values that are in my dataset. There doesn't seem to be a way to restrict the behavior where the library does not auto calculate the data point labels to show on x-axis.
If I have [250,500,1000,2000,4000,8000] as X-axis values and some corresponding values to each on Y ...then my chart is not showing the above data points labels on x..it shows some values like ...[125, 1700,3275,4850,6426,8000]....

@patreu22
Copy link

patreu22 commented Nov 5, 2016

Did you try barChart.drawValueAboveBarEnabled = true ? It works for me, but my x-axis values are 0...z

@sanjay2001
Copy link
Author

sanjay2001 commented Nov 7, 2016

@patreu22 my issue seem to be more on what values actually get displayed, I wanted to show values exactly as they are in my array ...but after I call [[LineChartDataSet alloc] initWithValues:values] the resulting data set has data that is different from x values i provided...looks like it re-calculates em..

@liuxuan30
Copy link
Member

liuxuan30 commented Nov 9, 2016

@sanjay2001 you are right, open func computeAxisValues(min: Double, max: Double) is calculating the x axis range. Take a look at the func and you will know. If you don't like it, set ForceLabelsEnabled = true.
Remember, the x and y you passed (if you are using Chart 3.0) are entry values, not x axis values. X axis shows label independently. Say you have x data like 1,2,3,4,6,7,8, by default it will show x axis labels like (0,2,4,6,8,10) to look nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants