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
|
//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%"; |