The precision of the axes

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

Posts: 10
Joined: Fri Oct 09, 2020 9:26 am

The precision of the axes

Post by hyetc » Thu Dec 03, 2020 3:58 am

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
Y_MajorTicks.png (25.75 KiB) Viewed 408 times
Y_Axis.png (8.35 KiB) Viewed 408 times

Posts: 401
Joined: Mon Mar 14, 2016 9:22 am

Re: The precision of the axes

Post by ArctionKestutis » Thu Dec 03, 2020 9:30 am


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.