This is another blog post that demonstrates working with charts in Java programmatically. Again, we will explore Aspose.Slides for Java and implement how to create a Pie chart in Java using methods exposed by this Pie chart API. So, this article will be focused on the automation of customizable Pie chart creation that will equip your business software with a Pie chart maker module. Therefore, please visit this category to learn about the blog posts that highlight the other prominent features of Aspose.Slides for Java.
We will cover these points:
- Pie Chart API Installation
- Create a Pie Chart in Java – Steps
- Java Pie Chart Example Code
Pie Chart API Installation#
The installation phase will take a few seconds. However, download this JAR file or you may use the Maven configurations.
Create a Pie Chart in Java – Steps#
The following steps show how to create a Pie chart in Java:
- Instantiate an instance of the Presentation class.
- Access first slide by calling the get_Item method.
- Add chart with default data by calling the addChart method.
- Invoke the getChartDataWorkbook function to get the chart data worksheet.
- Add new categories by calling the add method.
- Call the addDataPointForPieSeries method to populate series data.
- The getDataPoints().get_Item(0) will return index (serial number in this collection) of data point in this collection.
- Setting Sector border by calling the setFillType method.
- Call the setFirstSliceAngle method to set rotation angle for Pie chart sectors.
- Save presentation with Pie chart by calling the save method.
Java Pie Chart Example Code#
Now, let’s make the code speak for itself: You can see the output in the image below:
Pie Chart Maker – Get a Free License#
You can get a free temporary license to try this Pie chart API without evaluation limitations.
Summing up#
To conclude, this guide covered how to create a Pie chart in Java using Aspose.Slides for Java. In addition, we also went through a Java Pie chart example code to implement the functionality. Moreover, you can navigate to the documentation pages, GitHub repo and API references to explore this Pie chart API further. Lastly, aspose.com is writing continually, so stay in touch for the latest updates.
Feel Free to Reach Out#
You can let us know about your questions or queries on our forum.
Frequently Asked Questions – FAQs#
How to create a Pie chart using Java?#
Aspose.Slides for Java provides a rich stack of features to create Pie charts programmatically. Above all, please visit this link to see the steps.
How do you create a Pie chart with specific data?#
This section shows how to develop a Pie chart maker in Java.
See Also#
- Convert Chart to Image in Java – Extract Charts From PPTX
- Lock and Unlock Shapes in PowerPoint PPT in Java