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

Free Support Forum - aspose.com

Number Format of Chart Data Labels Is Not Applied

When adding a clone chart to presentation, the data labels number format is not applied.
Aspose.Slides.NET - version 22.7.0

    private void btnChartDataLabelsNumFormatTest_Click(object sender, EventArgs e)
            {
                int defaultWorksheetIndex = 0;
                Presentation presentation = new Presentation();
                ISlide sld = presentation.Slides[0];

                //clone chart
                Presentation srcPres = new Presentation(@".\Templates\ShapeMaster.pptx");
                IShape _tmpMstrChart = srcPres.Slides[0].Shapes[0];

                IShape cloneShape = sld.Shapes.AddClone(_tmpMstrChart, 50, 50, 500, 300);

                IChart chart = (Chart)cloneShape;
                IChartDataWorkbook wb = chart.ChartData.ChartDataWorkbook;

                //clear sample data in workbook
                //chart.ChartData.ChartDataWorkbook.Clear(defaultWorksheetIndex);
                //chart.ChartData.Categories.Clear();

                IChartSeries series;
                series = chart.ChartData.Series.First(x => x.Name.ToString() == "Series1");
                series.DataPoints.Clear();
                series.DataPoints.AddDataPointForBarSeries(wb.GetCell(defaultWorksheetIndex, 1, 1, float.Parse("0.0714")));
                series.DataPoints.AddDataPointForBarSeries(wb.GetCell(defaultWorksheetIndex, 2, 1, null));
                series.DataPoints.AddDataPointForBarSeries(wb.GetCell(defaultWorksheetIndex, 3, 1, float.Parse("0.5")));

                series = chart.ChartData.Series.First(x => x.Name.ToString() == "Series2");
                series.DataPoints.Clear();
                series.DataPoints.AddDataPointForBarSeries(wb.GetCell(defaultWorksheetIndex, 1, 2, float.Parse("0.0514")));
                series.DataPoints.AddDataPointForBarSeries(wb.GetCell(defaultWorksheetIndex, 2, 2, null));
                series.DataPoints.AddDataPointForBarSeries(wb.GetCell(defaultWorksheetIndex, 3, 2, float.Parse("0.0614")));

                presentation.Save(@"C:\\Temp\\Chart_DataLabels_NumFormat_Test.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
            }

@agollamandala,
Thank you for contacting support. Could you please share the ShapeMaster.pptx file?

Hi Andrey,

I tried to upload the .pptx file, but not able to. i’m getting this error
Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, zip, pdf, docx, 7z).

but, its a basic column chart, attached is a screenshot of the shapeMaster - chart object i have…
shapeMaster_ColumnChart.PNG (2.8 KB)

@agollamandala,
You can zip the presentation file and upload the archive here.

please find attached
ShapeMaster.zip (34.0 KB)

Thank you

@agollamandala,
Thank you for the presentation file. I’ve reproduced the problem with cloning the chart and added a ticket with ID SLIDESNET-43346 to our issue tracking system. We apologize for any inconvenience. Our development team will investigate the case. We will inform you of any progress.