In ppt I have tried this please find below steps for
steps - got to the chart edit data and click on design tab and select data source this select data source has horizontal (category) axis. I have set the range of this category and it will grouping this category using stacked column chart.
Need to know about how I will achieve it by programmatically using aspose 17.8
@tekchandp,
Thank you for posting the query. Unfortunately, I did not understand what you need to do.
Could you upload a presentation file with the chart example created in PowerPoint that you need, please?
@tekchandp,
Thank you for the screenshots. It looks like Aspose.Slides does not have such a feature. I logged the issue with ID SLIDESJAVA-38601 in our tracking system. Our development team will consider the possibility to implement this feature. You will be notified when this capability is added.
@tekchandp,
Our development team investigated the issue. You can use getGroupingLevels
and setGroupingItem
methods as shown below:
Presentation presentation = new Presentation();
IChart chart = presentation.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 100, 100, 400, 350);
chart.getChartData().getSeries().clear();
chart.getChartData().getCategories().clear();
IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook();
workbook.clear(0);
chart.getChartData().getCategories().add(workbook.getCell(0, "B2", "A"));
chart.getChartData().getCategories().add(workbook.getCell(0, "B3", "B"));
chart.getChartData().getCategories().get_Item(0).getGroupingLevels().setGroupingItem(1, "Group 1");
chart.getChartData().getCategories().add(workbook.getCell(0, "B4", "C"));
chart.getChartData().getCategories().add(workbook.getCell(0, "B5", "D"));
chart.getChartData().getCategories().get_Item(2).getGroupingLevels().setGroupingItem(1, "Group 2");
chart.getChartData().getCategories().add(workbook.getCell(0, "B6", "E"));
chart.getChartData().getCategories().add(workbook.getCell(0, "B7", "F"));
chart.getChartData().getCategories().get_Item(4).getGroupingLevels().setGroupingItem(1, "Group 3");
chart.getChartData().getCategories().add(workbook.getCell(0, "B8", "G"));
chart.getChartData().getCategories().add(workbook.getCell(0, "B9", "H"));
chart.getChartData().getCategories().get_Item(6).getGroupingLevels().setGroupingItem(1, "Group 4");
chart.getChartData().getSeries().add(workbook.getCell(0, "C1", "Series 1"), ChartType.ClusteredColumn);
chart.getChartData().getSeries().get_Item(0).getDataPoints().addDataPointForBarSeries(workbook.getCell(0, "C2", 10));
chart.getChartData().getSeries().get_Item(0).getDataPoints().addDataPointForBarSeries(workbook.getCell(0, "C3", 20));
chart.getChartData().getSeries().get_Item(0).getDataPoints().addDataPointForBarSeries(workbook.getCell(0, "C4", 30));
chart.getChartData().getSeries().get_Item(0).getDataPoints().addDataPointForBarSeries(workbook.getCell(0, "C5", 40));
chart.getChartData().getSeries().get_Item(0).getDataPoints().addDataPointForBarSeries(workbook.getCell(0, "C6", 50));
chart.getChartData().getSeries().get_Item(0).getDataPoints().addDataPointForBarSeries(workbook.getCell(0, "C7", 60));
chart.getChartData().getSeries().get_Item(0).getDataPoints().addDataPointForBarSeries(workbook.getCell(0, "C8", 70));
chart.getChartData().getSeries().get_Item(0).getDataPoints().addDataPointForBarSeries(workbook.getCell(0, "C9", 80));
presentation.save("output.pptx", SaveFormat.Pptx);
Documents: Creating Multi Category Charts
API Reference: ChartCategory class, IChartCategoryLevelsManager interface