How to show the percentage in axis Y?


Author
Message
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Jacky,

If the values on displayed on the axis are ready for percentage formatting - that is all values are rescaled to the range [0, 1] then you can simply change the formatting to percentage - for example:

NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.Values.Add(0.1);
bar.Values.Add(0.2);
bar.Values.Add(0.3);
chart.Series.Add(bar);

NLinearScaleConfigurator scale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
scale.LabelValueFormatter = new NNumericValueFormatter("P");

Otherwise you can use the ValueScale property of the scale label style:

NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);
chart.Series.Add(bar);

NLinearScaleConfigurator scale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
scale.LabelStyle.ValueScale = 0.01;
scale.LabelValueFormatter = new NNumericValueFormatter("P");

Hope this helps - let us know if you meet any problems.



Best Regards,
Nevron Support Team


Jacky zhang
Jacky zhang
Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)Junior Member (16 reputation)
Group: Forum Members
Posts: 16, Visits: 1

Hi,

How to show the percentage in axis Y?

I have a 3D bar chart and I want to show axis Y value as percentage just like Gallery - XY Scatter Bubble chart.

Can you give a sample code?

thanks again,

-Jacky

 

 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search