This is a migrated thread and some comments may be shown as answers.

ChartValueFormat.percent do not work

3 Answers 59 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 27 Apr 2012, 12:10 PM
I need to format YAxis with percent format. If I put a percent format and addRange, don't work my graph. Below a example:

radChart.PlotArea.YAxis.AutoScale = false;
radChart
.PlotArea.YAxis.AddRange(1,100,1);
radChart
.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.Percent;
radChart
.PlotArea.YAxis.Appearance.CustomFormat = "#.###";

If I remove the lines below, the scale start 0 and end 10.000,00 with step of 1.000,00. 

radChart.PlotArea.YAxis.AutoScale = false;
 radChart.PlotArea.YAxis.Appearance.CustomFormat = "#.###"; 
radChart.PlotArea.YAxis.AddRange(1,100,1);  


How do I do to work with AddRange()  and percent(I need to show percent simbol(%) in YAxis with my range values). 

Thanks.



3 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 02 May 2012, 12:05 PM
Hi Paulo,

You should set the ValueFormat and CustomFormat before turning the AutoScale proeprty of the axis to false:

RadChart1.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.Percent;
RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "#.###";
RadChart1.PlotArea.YAxis.AutoScale = false;
RadChart1.PlotArea.YAxis.AddRange(0, 50, 3);
RadChart1.AutoLayout = true;

Additionally you may need to set the AutoLayout property of the chart to true as it will automatically arrange the chart elements so that there is enough space for the axis labels to be fully readable:

RadChart1.AutoLayout = true;

Kind regards,
Evgenia
the Telerik team

If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Paulo
Top achievements
Rank 1
answered on 08 May 2012, 03:30 PM
Ok, Evgenia, but I have:

RadChart1.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.Percent;

RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "#.###";

RadChart1.PlotArea.YAxis.AutoScale = false;

RadChart1.PlotArea.YAxis.AddRange(930, 1000, 10);

RadChart1.AutoLayout = true;

YAxis scale is:
930.000,00% 100.000,00% and not 930,00% - 1000,00%

How can I do to remove from Yaxis(*1000)?

0
Evgenia
Telerik team
answered on 11 May 2012, 01:05 PM
Hello Paulo,

 This unwanted behavior is caused by the fact that the Percent ValueFormat acts as if you have used a "P" standard numeric format string. It multiles the number by 100 and adds a percent symbol at the end.
Instead I suggest that you use our CustomFormat property only with the following custom format string:

RadChart1.PlotArea.YAxis.Appearance.CustomFormat = "#,###\\%";

This way you format the numbers as you like and the % symbol is escaped.

Kind regards,
Evgenia
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Chart (Obsolete)
Asked by
Paulo
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Paulo
Top achievements
Rank 1
Share this question
or