ASP.NET Chart add percentage next to the number
Ok, I found the answer myself! thanks for everything ..
Here is the answer:
in order to just display "%" next to the number, just do the following:
Chart1.Series["MySeries"].Label = "#VALY"+"%";
OR (for the Y Axis for example:)
Chart1.ChartAreas[0].AxisY.LabelStyle.Format = "{#}%";
This worked fine for me!
Combining Yousi's solution with that of Alex Z
If your value is in decimal format, e.g. 0.14 = 14% then use this markup:
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<AxisY >
<LabelStyle Format="{0:p}" />
</AxisY>
</asp:ChartArea>
</ChartAreas>
If your value is the actual number you would like to see, just with % after it use this:
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<AxisY >
<LabelStyle Format="{#}%" />
</AxisY>
</asp:ChartArea>
</ChartAreas>
i.e. If you try the first block of code above and see values like 1,000% where you expect 10% use the second.
The "P" format specifier takes a number and considers it as a percent, so 1 will be translated to 100%. Can't you return the percentage like 0.1254?