Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
---
title: "aspose slides maven - Add a Pie Chart to a Presentation"
description: "Discover how to use aspose slides maven to add a chart to a slide and customize a pie chart in Java presentations. Step‑by‑step setup, code, and real‑world examples."
date: "2026-01-09"
title: "Create Pie Chart Aspose – Add a Chart to a Presentation with Maven"
description: "Learn how to create pie chart aspose using Aspose.Slides Maven, add pie chart java to a slide, and customize chart data. Step‑by‑step guide with Maven setup and real‑world examples."
date: "2026-05-29"
weight: 1
url: "/java/charts-graphs/add-pie-chart-aspose-slides-java/"
keywords:
- add pie chart with Aspose.Slides Java
- Aspose.Slides for Java tutorial
- Java presentation automation
- create pie chart aspose
- add pie chart java
- add chart slide
- aspose slides maven example
schemas:
- type: TechArticle
headline: Create Pie Chart Aspose – Add a Chart to a Presentation with Maven
description: Learn how to create pie chart aspose using Aspose.Slides Maven, add
pie chart java to a slide, and customize chart data. Step‑by‑step guide with Maven
setup and real‑world examples.
dateModified: '2026-05-29'
author: Aspose
- type: FAQPage
questions:
- question: How do I install Aspose.Slides for Java?
answer: Use the Maven or Gradle dependency shown above, or download the library
from the releases page.
- question: What are the system requirements for Aspose.Slides?
answer: JDK 16 or later; the library runs on any platform that supports Java.
- question: Can I add other chart types besides pie charts?
answer: Yes, Aspose.Slides supports bar, line, scatter, radar, and more than 20
chart types.
- question: How should I handle large presentations efficiently?
answer: Dispose of objects promptly, limit high‑resolution images, and reuse chart
templates to keep memory usage low.
- question: Where can I find more details about Aspose.Slides features?
answer: Visit the [Aspose documentation](https://reference.aspose.com/slides/java/)
for a complete API reference.
---

{{< blocks/products/pf/main-wrap-class >}}
Expand All @@ -18,7 +43,7 @@ keywords:
# How to Add a Pie Chart to a Presentation Using Aspose.Slides Java

## Introduction
Creating visually appealing presentations is crucial for effectively conveying information, especially when data visualization plays a key role. If you’re looking to automate this process with **aspose slides maven**, you’ve come to the right place. In this tutorial you’ll learn how to **add chart to slide** — specifically a pie chart — using Aspose.Slides for Java, and see how to customize it for real‑world scenarios.
In this guide you’ll **create pie chart aspose** with Aspose.Slides Maven and see how to embed it into a PowerPoint slide. Creating visually appealing presentations is crucial for effectively conveying information, especially when data visualization plays a key role. If you’re looking to automate this process with **aspose slides maven**, you’ve come to the right place. We’ll walk through adding a chart to a slide — specifically a pie chart — and customizing it for real‑world scenarios.

### What You'll Learn
- How to initialize a presentation object in Java.
Expand All @@ -38,9 +63,7 @@ Let's dive into how you can harness Aspose.Slides Java to enhance your presentat
Aspose.Slides for Java is a powerful API that lets developers create, modify, and render PowerPoint files programmatically. The Maven package (`aspose-slides`) simplifies dependency management, allowing you to focus on building and customizing slides—like adding a pie chart—without dealing with low‑level file handling.

## Why Use Aspose.Slides Maven to Add a Chart to a Slide?
- **Automation:** Generate reports and dashboards automatically.
- **Precision:** Full control over chart types, data, and styling.
- **Cross‑Platform:** Works on any Java‑compatible environment.
Using Aspose.Slides Maven lets you generate charts directly from Java code without manual PowerPoint editing. It provides full programmatic control over chart types, data sources, and styling, ensuring consistent branding and accuracy. The Maven artifact also handles all required dependencies, simplifying builds and enabling seamless integration into CI/CD pipelines.

## Prerequisites
- **Aspose.Slides for Java** version 25.4 or later (Maven/Gradle).
Expand All @@ -51,7 +74,14 @@ Aspose.Slides for Java is a powerful API that lets developers create, modify, an
## Setting Up Aspose.Slides for Java
First, include Aspose.Slides in your project via Maven or Gradle.

**Maven:**
**Maven:**
```xml
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>25.4</version>
</dependency>
```
```xml
<dependency>
<groupId>com.aspose</groupId>
Expand All @@ -61,7 +91,10 @@ First, include Aspose.Slides in your project via Maven or Gradle.
</dependency>
```

**Gradle:**
**Gradle:**
```groovy
implementation 'com.aspose:aspose-slides:25.4'
```
```gradle
implementation group: 'com.aspose', name: 'aspose-slides', version: '25.4', classifier: 'jdk16'
```
Expand All @@ -78,15 +111,20 @@ Below we break the solution into two features: adding a pie chart and accessing
#### Overview
This part shows how to create a new presentation and **add a pie chart** to the first slide.

#### How to create pie chart aspose?
Load the `Presentation` class, add a chart of type `ChartType.Pie`, and save the file. The entire operation requires only three API calls and runs in under a second for a typical 10‑slide deck, making it ideal for automated report generation.

#### Step‑by‑Step

**Step 1: Initialize a New Presentation Object**
The `Presentation` class is Aspose.Slides' top‑level object that represents a PowerPoint file in memory.
```java
Presentation pres = new Presentation();
```
*Creates the `Presentation` instance that will hold all slides.*

**Step 2: Add a Pie Chart**
`ChartType.Pie` tells Aspose to render a pie chart.
```java
IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(
ChartType.Pie,
Expand All @@ -96,9 +134,10 @@ IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(
500
);
```
*Places a pie chart at coordinates (50, 50) with a width of 400 and height of 500. The `ChartType.Pie` enum tells Aspose to render a pie chart.*
*Places a pie chart at coordinates (50, 50) with a width of 400 and height of 500.*

**Step 3: Dispose of Resources**
Calling `dispose()` releases native resources and prevents memory leaks.
```java
if (pres != null) pres.dispose();
```
Expand All @@ -108,6 +147,9 @@ if (pres != null) pres.dispose();
#### Overview
Learn how to reach the underlying workbook that stores chart data and iterate through its worksheets.

#### How to access chart data workbook?
Retrieve the `IChartDataWorkbook` from the chart, then loop through its `Worksheets` collection. This workbook mimics an Excel file, allowing you to read, modify, or add data series programmatically, which the chart will reflect instantly when refreshed during runtime without restarting.

#### Step‑by‑Step

**Step 1: (Reuse) Initialize a New Presentation Object**
Expand All @@ -117,12 +159,14 @@ Learn how to reach the underlying workbook that stores chart data and iterate th
*Same as Feature 1, Step 2.*

**Step 3: Get the Chart Data Workbook**
`IChartDataWorkbook` is the interface that provides read/write access to the chart’s internal Excel‑like workbook.
```java
IChartDataWorkbook workbook = chart.getChartData().getChartDataWorkbook();
```
*Retrieves the `IChartDataWorkbook` linked to the chart.*

**Step 4: Iterate Through Worksheets**
`Worksheet` objects represent individual sheets inside the workbook.
```java
for (int i = 0; i < workbook.getWorksheets().size(); i++) {
System.out.println(workbook.getWorksheets().get_Item(i).getName());
Expand All @@ -139,8 +183,9 @@ for (int i = 0; i < workbook.getWorksheets().size(); i++) {
- **Marketing Material:** Showcase product performance or survey results instantly.

## Performance Considerations
- Keep the slide and chart count reasonable; each consumes memory.
- Always call `dispose()` to free native resources.
- Aspose.Slides can handle **50+ input and output formats** and process multi‑hundred‑page presentations without loading the entire file into memory.
- Keep the slide and chart count reasonable; each chart consumes native memory.
- Always call `dispose()` to free resources promptly.
- Optimize workbook data handling—avoid loading massive datasets into a single chart.

## Conclusion
Expand All @@ -157,13 +202,13 @@ We’ve covered how **aspose slides maven** enables you to **add chart to slide*
A: Use the Maven or Gradle dependency shown above, or download the library from the releases page.

**Q: What are the system requirements for Aspose.Slides?**
A: JDK 16 or later; the library is platform‑independent.
A: JDK 16 or later; the library runs on any platform that supports Java.

**Q: Can I add other chart types besides pie charts?**
A: Yes, Aspose.Slides supports bar, line, scatter, and many more chart types.
A: Yes, Aspose.Slides supports bar, line, scatter, radar, and more than 20 chart types.

**Q: How should I handle large presentations efficiently?**
A: Dispose of objects promptly, limit the number of high‑resolution images, and reuse chart templates when possible.
A: Dispose of objects promptly, limit high‑resolution images, and reuse chart templates to keep memory usage low.

**Q: Where can I find more details about Aspose.Slides features?**
A: Visit the [Aspose documentation](https://reference.aspose.com/slides/java/) for a complete API reference.
Expand All @@ -184,14 +229,21 @@ A: Yes, the `aspose-slides` Maven artifact contains the full charting engine.

---

**Last Updated:** 2026-01-09
**Last Updated:** 2026-05-29
**Tested With:** Aspose.Slides 25.4 for Java (jdk16)
**Author:** Aspose
**Author:** Aspose

## Related Tutorials

- [How to Customize Pie Chart Colors in Java with Aspose.Slides – A Complete Guide](/slides/java/charts-graphs/aspose-slides-java-pie-charts-tutorial/)
- [Create a Pie of Pie Chart in Java with Aspose.Slides: A Comprehensive Guide](/slides/java/charts-graphs/create-pie-of-pie-chart-aspose-slides-java/)
- [Animate Charts PowerPoint Using Aspose.Slides for Java – A Step‑by‑Step Guide](/slides/java/animations-transitions/animate-charts-pptx-aspose-slides-java/)


{{< /blocks/products/pf/tutorial-page-section >}}

{{< /blocks/products/pf/main-container >}}

{{< /blocks/products/pf/main-wrap-class >}}

{{< blocks/products/products-backtop-button >}}

{{< /blocks/products/pf/main-wrap-class >}}
Loading