Develop a Scatter Graph Creator in Java

What We’re Aiming For

This blog post will enable you to automate the creation of charts programmatically. We will try to make things fairly simple by writing a code snippet to develop a scatter graph creator in Java. Aspose.Slides for Java is a powerful yet lightweight Java API for creating and manipulating charts. Moreover, this high-level API offers a developer-friendly ecosystem compared to other competing APIs. So, let’s move on and get to the point.

Java API For Charts - Installation

You may consider visiting the installation details here. In a nutshell, you can download this JAR file or use the following Maven configurations to install this Java charting library:

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository> 
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-slides</artifactId>
    <version>24.4</version>
    <classifier>jdk16</classifier>
</dependency>

Develop a Scatter Graph Creator - Code Snippet

So, we are now writing the steps to follow:

  • Create an instance of the Presentation class.
  • Invoke the get_Item method to access the first slide.
  • Creating the default chart by calling the addChart method.
  • Call the getChartDataWorkbook method to get the chart data worksheet.
  • Add a new chart category by calling the add method.
  • Add a new point (1:3) by calling the addDataPointForScatterSeries method.
  • Set the type of series by calling the setType method.
  • Set the marker size in the chart by calling the setSize method.
  • Invoke the setSymbol method to set the marker style in the chart.
  • Save the output PPTX/PPT file on the disk by calling the save method.

Below is the code sample showing how to develop a scatter graph creator in Java programmatically:

java-api-for-charts

Get a Free License

You can get a free temporary license to try this Java charting library without evaluation limitations.

Summing up

While Aspose.Slides for Java provides a wide range of features to programmatically create and manipulate charts, there is comprehensive documentation available. In addition, you can jump to the API refs and GitHub repo to start developing a scatter graph creator in Java. Moreover, you can visit this link for a quick rundown to learn about all the features offered.

Feel Free to Reach Out

You can let us know about your questions or queries on our forum.

See Also