-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Y Axis range calculation is incorrect for Bar Charts #2386
Comments
As you just have one value, it's expected.
If you want from 0, just set |
I don't think that works. The values I'm consuming come from a service. I don't know beforehand if the values are positive or negative. If I get a negative value from the service setting axisMinValue to 0 makes the chart not render correctly. This will happen whenever the min and max chart values are close in range no matter how many values are being rendered in the chart. |
You just want pure negative value or positive value to start from 0, and some other people don't want this. We can't make the decision so it's you to make. The library will use the max/min value to decide the range if you don't touch anything, so it usually works. For your case, you can add a simple scan of your data to see if you want to start from 0 before displaying the chart. |
When calculating the y axis range in the YAxis.swift calculate function if only one chart value is provided to the chart the range calculation is always 2.0.
This is because the dataMin and dataMax values passed to the method are the same.
It seems to me the range should always be calculated from the zero value.
If both dataMin and dataMax passed to the calculate method are positive, the range should be (dataMax - 0).
If both dataMin and dataMax passed to the calculate method are negative, the range should be 0 -dataMin.
if dataMin is negative and dataMax is positive, the range should be dataMax - dataMin.
Is the current behavoir expected?
The text was updated successfully, but these errors were encountered: