PieChartView Class
Contains settings that apply to pie series in a chart view.
Declaration
public class PieChartView extends SlicedChartView
Remarks
When you add a PieSeries object to a chart, the chart creates a PieChartView object for the series. Call the Chart.getViews() method to access chart views.
Refer to the following help topic for additional information: Create Standard Charts — Presentation API for Java.
Example
Create a Pie Chart with an Exploded Slice
The following code snippet creates a pie chart, pulls the first slice out of the pie, displays category names and percentages in data labels, and applies bold text formatting to the first data label:
import java.io.*;
import java.nio.file.*;
import java.util.List;
import com.devexpress.docs.office.*;
import com.devexpress.docs.presentation.*;
public class Main {
public static void main(String[] args) throws Exception {
try (Presentation presentation = new Presentation()) {
// Add a blank slide.
presentation.getSlides().clear();
Slide slide = new Slide(SlideLayoutType.BLANK);
presentation.getSlides().add(slide);
// Insert a chart that fills the slide.
Chart chart = new Chart();
chart.setWidth(presentation.getSlideSize().getWidth());
chart.setHeight(presentation.getSlideSize().getHeight());
slide.getShapes().add(chart);
// Create a pie series and specify data.
PieSeries series = new PieSeries();
series.setText("Budget");
series.setArguments(new ChartStringData(List.of("Salaries", "Marketing", "Rent", "Equipment", "Travel")));
series.setValues(new ChartNumericData(List.of(48.0, 20.0, 15.0, 10.0, 7.0)));
chart.getSeries().add(series);
// Pull the first slice out of the pie.
DataPoint salaries = new DataPoint();
salaries.setExplosion(15);
series.getCustomDataPoints().put(0, salaries);
// Color each slice differently.
PieChartView view = (PieChartView) chart.getViews().get(0);
view.setVaryColors(true);
// Display category names and percentages outside slices.
IPieDataLabels dataLabels = series.getDataLabels();
dataLabels.setShowCategoryName(true);
dataLabels.setShowPercent(true);
dataLabels.setLabelPosition(PieDataLabelPosition.OUTSIDE_END);
// Apply bold text formatting to the data label of the first slice.
TextProperties boldText = new TextProperties();
boldText.setBold(true);
PieDataLabel salariesLabel = new PieDataLabel();
salariesLabel.setShowCategoryName(true);
salariesLabel.setShowPercent(true);
salariesLabel.setLabelPosition(PieDataLabelPosition.OUTSIDE_END);
salariesLabel.setTextProperties(boldText);
dataLabels.setLabel(0, salariesLabel);
// Save the presentation.
Files.createDirectories(Path.of("output"));
try (OutputStream output = Files.newOutputStream(Path.of("output", "Chart.pptx"))) {
presentation.save(output);
}
}
}
}
The following screenshot illustrates the result:

Inherited Members
Inheritance
PieChartView()
Initializes a new instance of the PieChartView class.
Declaration
public PieChartView()
Methods
getChartType() Method
Returns the chart type of the view.
Declaration
public ChartType getChartType()
Returns
| Type | Description |
|---|---|
| ChartType |
|
getDataLabels() Method
Returns data label settings for all series in the view.
Declaration
public IPieDataLabels getDataLabels()
Returns
| Type | Description |
|---|---|
| IPieDataLabels | Data label settings. |
Remarks
Call the PieSeries.getDataLabels() method to access data label settings for an individual series.
Refer to the following help topic for additional information: Customize Chart Data Labels — Presentation API for Java.