Customize Doughnut Charts in Presentations Using JavaScript
Contents
[
Hide
]
Change Center Gap in Doughnut Chart
Aspose.Slides for Node.js via Java now supports specifying the size of the hole in a doughnut chart. In this topic, we will see with example how to specify the size of the hole in a doughnut chart.
In order to specify the size of the hole in a doughnut chart, please follow the steps below:
- Instantiate Presentation object.
- Add doughnut chart on the slide.
- Specify the size of the hole in a doughnut chart.
- Write presentation to disk.
In the example given below, we have set the size of the hole in a doughnut chart.
// Create an instance of Presentation class
var pres = new aspose.slides.Presentation();
try {
var chart = pres.getSlides().get_Item(0).getShapes().addChart(aspose.slides.ChartType.Doughnut, 50, 50, 400, 400);
chart.getChartData().getSeriesGroups().get_Item(0).setDoughnutHoleSize(90);
// Write presentation to disk
pres.save("DoughnutHoleSize_out.pptx", aspose.slides.SaveFormat.Pptx);
} finally {
if (pres != null) {
pres.dispose();
}
}
FAQ
Can I create a multi-level doughnut with multiple rings?
Yes. Add multiple series to a single doughnut chart—each series becomes a separate ring. The ring order is determined by the order of the series in the collection.
Is an “exploded” doughnut (separated slices) supported?
Yes. There is an Exploded Doughnut chart type and an explosion property on data points; you can separate individual slices.
How can I get an image of a doughnut chart (PNG/SVG) for a report?
A chart is a shape; you can render it to a raster image or export the chart to an SVG image.