Column graph is in decimal point instead of percents

Hi

I following columns chart is supposed to be in percents, but I keep getting decimal points instead.

I tried the following code, but with no success.

var series1 = chart.Series[0];
var series2 = chart.Series[1];
for (int i = series1.Values.FirstRow; i <= series1.Values.LastRow && i <= series2.Values.LastRow ; i++)
{
series1.DataPoints[i - series1.Values.FirstRow].DataLabels.IsValue = true;
series2.DataPoints[i - series2.Values.FirstRow].DataLabels.IsValue = true;
series1.DataPoints[i - series1.Values.FirstRow].DataLabels.NumberFormat = "0%";
series2.DataPoints[i - series2.Values.FirstRow].DataLabels.NumberFormat = "0%";
series1.DataPoints[i - series1.Values.FirstRow].DataLabels.IsPercentage = true;
series2.DataPoints[i - series2.Values.FirstRow].DataLabels.IsPercentage = true;
}

I attached the PPTX file


Attachment: Presentation1.pptx_46c6d2a.zip

3 Replies 1 reply marked as answer

MR Manikandan Ravichandran Syncfusion Team March 3, 2022 04:00 PM UTC

Hi Moran,

We have reproduced the reported problem with datapoint label number format not changed when changing the datapoint label number format as percentage by accessing the chart in the Presentation document. Currently, we are validating this issue and we will update the details on 7th March 2022.

Regards,
Manikandan Ravichandran 



MR Manikandan Ravichandran Syncfusion Team March 7, 2022 03:18 PM UTC

Hi Moran,

Still, we are validating this issue and we will share the details on 08th March 2022 without further delay.

Regards,
Manikandan Ravichandran 



MR Manikandan Ravichandran Syncfusion Team March 8, 2022 05:48 PM UTC

Hi Moran,

On further checking the reported problem, we have found that the Microsoft PowerPoint Presentation application also not apply the data label number format properly. But, when we disable data label and again set the data label and change the number format as percentage, it works fine in Microsoft PowerPoint Presentation. So, to resolve the issue, you can disable the data label and save the PPTX file using Microsoft PowerPoint Presentation application and use that resaved document in Essential Presentation to change the data label number format.

We have modified the given PPTX document, and it can be downloaded from the below link.
https://www.syncfusion.com/downloads/support/forum/173327/pp/Presentation1825146391

Please refer the below code example to change the number format as percentage. 
//Gets the chart in slide
IPresentationChart chart = slide.Shapes[9] as IPresentationChart;
chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.IsValue =
true;
chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.NumberFormat =
"0%";
chart.Series[1].DataPoints.DefaultDataPoint.DataLabels.IsValue =
true;
chart.Series[1].DataPoints.DefaultDataPoint.DataLabels.NumberFormat =
"0%";

chart = slide.Shapes[16]
as IPresentationChart;
chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.IsValue =
true;
chart.Series[0].DataPoints.DefaultDataPoint.DataLabels.NumberFormat =
"0%";
chart.Series[1].DataPoints.DefaultDataPoint.DataLabels.IsValue =
true;
chart.Series[1].DataPoints.DefaultDataPoint.DataLabels.NumberFormat =
"0%";

 

Regards,
Manikandan Ravichandran 


Marked as answer
Loader.
Up arrow icon