Hi,
Hi Ankit,
I have observed your requirements and like to share that I have tested the addChart() method that is failing on your end using Aspose.Slides for Java 16.12.0 on my end and it generated a presentation with empty chart series and categories as expected in accordance with set inItwithSample value to false. I have tested using following code and have also attached the generated presentation.
public static void TestChart2()
{
Presentation pres = new Presentation();
ISlide slide = pres.getSlides().get_Item(0);
IChart chart = slide.getShapes().addChart(ChartType.Doughnut, 100, 100, 400, 300,false);
pres.save(“C:\Aspose Data\Doughnut.pptx”, SaveFormat.Pptx);
}
Many Thanks,
Hi Mudassir,
Thank you for your reply.
IChartDataWorkbook iChartDataWorkbook = ichart.getChartData().getChartDataWorkbook();
Hi Ankit,
Hi Muhammad,
Hi Ankit,
I have observed the presentation file shared by you and request you and have been able to observe the issue specified. An issue with ID SLIDESJAVA-35853 has been created in our issue tracking system to fuhrer investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.
We are sorry for your inconvenience,
Hi Ankit,
I have used following sample code and Aspose.Slides for Java 17.4 on my end to generate Doughnut chart successfully. Can you please try using the following sample code on your end to serve the purpose.
public static void TestDoughnut()
{
Presentation pres = new Presentation();
ISlide islide = pres.getSlides().get_Item(0);
IChart ichart = islide.getShapes().addChart(ChartType.Doughnut, 10, 10, 500, 500, false);
int defaultWorksheetIndex = 0;
// Getting the chart data work sheet.
IChartDataWorkbook iChartDataWorkbook = ichart.getChartData().getChartDataWorkbook();
// Delete default generated series and categories
ichart.getChartData().getSeries().clear();
ichart.getChartData().getCategories().clear();
IChartCategory iChartCategory1= ichart.getChartData().getCategories().add(iChartDataWorkbook.getCell(defaultWorksheetIndex, 1, 0, “category1”));
IChartCategory iChartCategory2= ichart.getChartData().getCategories().add(iChartDataWorkbook.getCell(defaultWorksheetIndex, 2, 0, “category2”));
IChartCategory iChartCategory3= ichart.getChartData().getCategories().add(iChartDataWorkbook.getCell(defaultWorksheetIndex, 3, 0, “category3”));
IChartSeries iChartSeries = ichart.getChartData().getSeries().add(iChartDataWorkbook.getCell(defaultWorksheetIndex, 0, 1, “test”), ichart.getType());
// Setting hole size and colors of the series
iChartSeries.getParentSeriesGroup().setDoughnutHoleSize((byte)50);
iChartSeries.getParentSeriesGroup().setColorVaried(true);
iChartSeries.getDataPoints().addDataPointForDoughnutSeries(iChartDataWorkbook.getCell(defaultWorksheetIndex, 1, 1, 10));
iChartSeries.getDataPoints().addDataPointForDoughnutSeries(iChartDataWorkbook.getCell(defaultWorksheetIndex, 2, 1, 20));
iChartSeries.getDataPoints().addDataPointForDoughnutSeries(iChartDataWorkbook.getCell(defaultWorksheetIndex, 3, 1, 30));
pres.save(“c:\Aspose Data\doughnut-new.pptx”, SaveFormat.Pptx);
}
Many Thanks,