-
-
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
Force axis granularity #3727
Comments
the granularity is not what you think. read the comment
|
for how-to question, ask on stack overflow. |
Is it possible to hide the axis values? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a line chart that plots values every three hours. I would like the x axis to label every 24 hours so I set granularity to 8. However the values never line up appropriately I think because of the normalization code below. Is it possible to force the granularity to a certain value?
if axis.granularityEnabled { interval = interval < axis.granularity ? axis.granularity : interval } // Normalize interval let intervalMagnitude = pow(10.0, Double(Int(log10(interval)))).roundedToNextSignficant() let intervalSigDigit = Int(interval / intervalMagnitude) if intervalSigDigit > 5 { // Use one order of magnitude higher, to avoid intervals like 0.9 or 90 // if it's 0.0 after floor(), we use the old value interval = floor(10.0 * intervalMagnitude) == 0.0 ? interval : floor(10.0 * intervalMagnitude) }
The text was updated successfully, but these errors were encountered: