Page 1 of 1

The precision of the axes

Posted: Thu Dec 03, 2020 3:58 am
by hyetc
Get the corresponding primary label by getting the MajorTicks method on the Y-axis
The value that should be zero in the middle becomes a very small value due to the accuracy problem。
Is there a solution

Re: The precision of the axes

Posted: Thu Dec 03, 2020 9:30 am
by ArctionKestutis
Hi,

As you noticed already, dividing axis range into equally spaced intervals/ticks not always end up in nice rounded numbers.
The main question, how do you convert the double values into label (string)? If you are calling .NET Value.ToString() method with no argument (IFormatProvider / string), then Default ("G") format is used. Unfortunately, this is how standard “G” formatting sometimes works (i.e. produce this long strings of meaningless values). The only workaround is to create own formatting string. For example, Value.ToString("0.00").
Check Standard and Custom numeric formats, which suit you best.