We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Data Label is formatted to Percentage by Default. Unable to format it to Number

Hi,

I am using Aspose Slides for Java. Version: 17.8

I have a chart which has data labels.
One of the data series is plotted on Secondary Axis as Line With Markers Chart.
Data Points in the series are of decimal type.
I am using the below snippet to format Data labels.

chart.getChartData().getSeries().get_Item(2).getLabels().getDefaultDataLabelFormat()
            .setNumberFormat("0.00");

It is formatting to Percentage. I want it formatted as Number.

Please let me know if I am missing anything or if there is an alternative way.

@gagangupt16,

I have observed your comments. I have codes snippet with you. This will help you to achieve your requirements.

IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 50, 50, 600, 400, true);
IChartSeriesCollection series = chart.getChartData().getSeries();
IDataLabel label = series.get_Item(0).getLabels().get_Item(0);
label.getDataLabelFormat().setShowValue(true);
msAssert.areEqual(label.getDataLabelFormat().getNumberFormat(), “”);
label.getDataLabelFormat().setNumberFormat(“0.00”);
msAssert.areEqual(label.getDataLabelFormat().getNumberFormat(), “0.00”);

Thanks Adnan but the above snippet is not still able to format beyond a certain number of labels.

Also, in your snippet, you have created chart. In my scenario, I already have an existing PPT and I need to modify that chart.

@gagangupt16,

I have observed your comments and request you to please share the working sample project along with source presentation and generated presentation. Please also provide the desired presentation as well. We will investigate the requirements further on our end to help you.