6

How can I format chart label? I need to see only 2 digits after point.

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

Also I try to set Series[0].LabelFormat = "0.00" and #.##

and without success.

What is wrong?

current chart

Dumitru
  • 833
  • 3
  • 12
  • 26

4 Answers4

7

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

Cain
  • 918
  • 6
  • 9
4

try this

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

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

LVEYO
  • 356
  • 2
  • 5
0

You could 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

Tom
  • 1,047
  • 3
  • 24
  • 44
0

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