Custom Axis Label Number Format

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
TRVRSE
Posts: 21
Joined: Fri May 30, 2014 1:27 pm

Custom Axis Label Number Format

Post by TRVRSE » Wed Jun 11, 2014 2:24 pm

I'm wondering the best way to achieve this goal.

Goal: Apply a custom number format to the Axis Label Numbers.

The desired Number format is Engineering Notation. For example, suppose the axis labels are showing the numbers [2; 2,000; 2,000,000; 2,000,000,000]. In engineering format, these labels would be [2, 2k, 2M, 2G], or even [2.0, 2.0k, 2.0M, 2.0G]. Is there a format label function I can override? I do not think I can achieve this with the AxisBase.LabelsNumberFormat property.

Thanks!

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Custom Axis Label Number Format

Post by ArctionPasi » Wed Jun 11, 2014 6:38 pm

LabelsNumberFormat accepts standard .net double.ToString() formatting, and this 'k', 'M', 'G', 'T', 'P' etc. isn't supported in it, AFAIK.

The engineering format has to be made with axis.FormatValueLabel event handler. In the handler, you get the actual value, and you can output the value as a string of any format.
LightningChart Support Team, PT

n0kx
Posts: 8
Joined: Mon Apr 27, 2015 7:14 pm

Re: Custom Axis Label Number Format

Post by n0kx » Thu May 28, 2015 1:49 pm

ArctionPasi wrote:LabelsNumberFormat accepts standard .net double.ToString() formatting, and this 'k', 'M', 'G', 'T', 'P' etc. isn't supported in it, AFAIK.

The engineering format has to be made with axis.FormatValueLabel event handler. In the handler, you get the actual value, and you can output the value as a string of any format.
Do you know where I can find an example of this? I'm running into the same issue. Thanks!

ArctionJari

Re: Custom Axis Label Number Format

Post by ArctionJari » Fri May 29, 2015 6:47 am

In our demo application, for example "Business dashboard" (under "Dashboards") uses FormatValueLabel event. Example's class/file name is ExampleBusinessDashboard.

Other examples are ExampleAxisLabelRangeEdit and ExamplePersistentIntensitySignal.

Post Reply