Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Chart add percentage next to the number

I have a chart control that is displaying columns with values on top (series with labels). Those values come from the database and they are already in the percentage format (i.e.: displaying 12.54 not 0.1254)

I want to add the "%" next to the numbers.

when I try to use the "LabelFormat" property and set it to "P2" i get the numbers like this:

1254.00% !!

I think the P2 is doing some calculations!

I just want to add the "%" symbol next to the number. that's it

can anyone help?

like image 796
Yousi Avatar asked Nov 13 '11 08:11

Yousi


1 Answers

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!

like image 171
Yousi Avatar answered Oct 02 '22 18:10

Yousi