MSChart: Label format
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?
Try setting .AxisX.LabelStyle.Format
to "{0:0.00}"
- I had to do it recently on one of my charts so it should work.
try this
chart.ChartAreas.First().AxisY.LabelStyle.Format = "F2";
and the details on this page http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx
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
Set the YValueType="Double" and the LabelFormat="C" within the tag.
精彩评论