MSChart: shortcut format

How can I format a chart shortcut? I need to see only 2 digits after the dot.

I try chart.ChartAreas.First().AxisY.LabelStyle.Format = "#.##"; and 0.00

Also I'm trying to set Series[0].LabelFormat = "0.00" and #.##

and without success.

What's wrong?

current chart

+6
source share
4 answers

Try setting .AxisX.LabelStyle.Format to "{0:0.00}" - I had to do this recently on one of my diagrams to make it work.

+7
source

try it

 chart.ChartAreas.First().AxisY.LabelStyle.Format = "F2"; 

and details on this page http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx

+3
source

You can also iterate over your list. Here is what I did for percentages:

 foreach (var point in Chart.Series[0].Points) { point.Label = point.YValues[0].ToString("P2"); point.LegendText = point.YValues[0].ToString("P2") + " - " + point.AxisLabel; } 

Set

0
source

Set YValueType = "Double" and LabelFormat = "C" in the tag.

0
source

Source: https://habr.com/ru/post/889891/


All Articles