Hi!
I need to implement a FormatValueLabel handler, since we need values displayed with SI suffixes for kilo, milli, giga etc - e.g. "23.451m" instead of "0,023451" or "2,3451E-2".
However, I cannot figure out how many decimals to show? I tried to use FormatValueLabelEventArgs.Axis.MajorDiv,
but that seems to just return (max-min)/Axis.MajorDivCount? And this make me generate numbers with way too few digits, especially when zooming?
How can I find out what the numerical distance between labels are, so I can generate a sufficient number of digits?
The built in formatting seems to do it nicely, but doesn't fit our requirements?
Or is there another way to do this?
Correct implementation of FormatValueLabel?
Moderator: Queue Moderators
-
- Posts: 557
- Joined: Mon Mar 14, 2016 9:22 am
Re: Correct implementation of FormatValueLabel?
Hi,
There is Axis.Units property tree. You could make it visible and have any text. Would it be useful in this case?
There is Axis.Units property tree. You could make it visible and have any text. Would it be useful in this case?
Re: Correct implementation of FormatValueLabel?
I assume this would require us to rescale all the actual values?
That would be a bit impractical - the user might start with a plot from [-2;2] but then zoom in to see [-0.150 ; 0.150] - we need to show the labels as e.g. -150m, -100m, -50m, 0, 50m, 100m, 150m
So I don't think that would work?
That would be a bit impractical - the user might start with a plot from [-2;2] but then zoom in to see [-0.150 ; 0.150] - we need to show the labels as e.g. -150m, -100m, -50m, 0, 50m, 100m, 150m
So I don't think that would work?
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Correct implementation of FormatValueLabel?
Hello, you could also utilize axis.GetMajorTicks() to learn the tick positions. Use that info to format the labels. Note that GetMajorTicks returns the latest rendered positions.
Using CustomAxisTicks is the "ultimate" way to do it, you get explicit control of positions of ticks, and formatting of labels as you can enter any text in the CustomAxisTicks. Remember to set axis.AutoFormatLabels =false, otherwise automatic formatting takes over.
Using CustomAxisTicks is the "ultimate" way to do it, you get explicit control of positions of ticks, and formatting of labels as you can enter any text in the CustomAxisTicks. Remember to set axis.AutoFormatLabels =false, otherwise automatic formatting takes over.
LightningChart Support Team, PT
Re: Correct implementation of FormatValueLabel?
Thank you - just what I needed!