Zero is not zero
Moderator: Queue Moderators
Zero is not zero
Sometimes an axis doesn't show zero where it should. See Y axis in the attachment. Reproducable by zooming in and panning around a little.
- Attachments
-
- zero-not-zero.png (83.08 KiB) Viewed 9533 times
Re: Zero is not zero
This is most likely result of Double value rounding inaccuracy. In normal life that value (1.7E-24) is zero but 0.0000...0017 is not exactly zero when it is parsed to string.
You can however parse the values yourself if you know how accurate values you need. Just subscribe to axis' FormatValueLabel and use e.g. Math.Round to round values with required fractional digit count.
You can however parse the values yourself if you know how accurate values you need. Just subscribe to axis' FormatValueLabel and use e.g. Math.Round to round values with required fractional digit count.
Re: Zero is not zero
It's definitely double inaccuracy, but caused by the fact that the labels are calculated from one side of the axis to the other. If you start labelling a 0, zero would actually be 0 no matter the zoom level/padding. Another solution might determine the step value between the labels (you probably already do that!) and if the calculated value is less than the step, replace the value with 0.
In my opinion it's a bug that can easily be fixed and not something I, as a user, must workaround with subscribing to FormatValueLabel and rounding myself.
In my opinion it's a bug that can easily be fixed and not something I, as a user, must workaround with subscribing to FormatValueLabel and rounding myself.