开发者

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?

MSChart: Label format


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜