ParetoSeries Class
A series that displays the cumulative percentage line of a Pareto chart.
Declaration
public class ParetoSeries extends SeriesExBase
Remarks
A Pareto chart combines histogram columns with a line that displays the cumulative percentage of the total. To create a Pareto chart, add a HistogramSeries object to the ChartEx.getSeries() collection, then add a ParetoSeries object that refers to the histogram series.
If the collection does not contain the histogram series, the add method of the collection throws an InvalidOperationException. If you remove the histogram series from the collection, the chart also removes the Pareto series.
Refer to the following help topic for additional information: Create Waterfall, Funnel, Treemap, and Other Office 2016 Charts — Presentation API for Java.
Example
Create a Pareto Chart
The following code snippet creates a Pareto chart from a histogram series that sums values by category and displays a data label for one point of the Pareto line:
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.
ChartEx chart = new ChartEx();
chart.setWidth(presentation.getSlideSize().getWidth());
chart.setHeight(presentation.getSlideSize().getHeight());
slide.getShapes().add(chart);
// Create a histogram series that sums values in each category.
HistogramSeries histogram = new HistogramSeries();
histogram.setText("Defects");
histogram.setArguments(new ChartStringData(List.of("Scratch", "Dent", "Crack", "Stain", "Other")));
histogram.setValues(new ChartNumericData(List.of(42.0, 25.0, 15.0, 10.0, 8.0)));
histogram.setBinType(HistogramBinType.BY_CATEGORY);
chart.getSeries().add(histogram);
// Add a Pareto line after the histogram series.
ParetoSeries pareto = new ParetoSeries(histogram);
chart.getSeries().add(pareto);
// Display the cumulative percentage for the third category.
ParetoDataLabel label = new ParetoDataLabel();
label.setShowValue(true);
pareto.getDataLabels().setLabel(2, label);
// Save the presentation.
Files.createDirectories(Path.of("output"));
try (OutputStream output = Files.newOutputStream(Path.of("output", "Chart.pptx"))) {
presentation.save(output);
}
}
}
}
Inherited Members
Inheritance
Constructors
ParetoSeries() Constructor
Initializes a new instance of the ParetoSeries class.
Declaration
public ParetoSeries()
ParetoSeries(HistogramSeries histogramSeries) Constructor
Initializes a new instance of the ParetoSeries class with the specified histogram series.
Declaration
public ParetoSeries(HistogramSeries histogramSeries)
Parameters
| Name | Type | Description |
|---|---|---|
| histogramSeries | HistogramSeries | The histogram series that supplies values for the Pareto line. |
Methods
deepClone() Method
Creates a copy of the Pareto series.
Declaration
public ParetoSeries deepClone()
Returns
| Type | Description |
|---|---|
ParetoSeries |
A copy of the Pareto series. |
Remarks
The copy does not refer to a histogram series. Call the setHistogramSeries(HistogramSeries value) method of the copy to specify the histogram series.
getChartType() Method
Returns the chart type of the series.
Declaration
public ChartExType getChartType()
Returns
| Type | Description |
|---|---|
| ChartExType |
|
getDataLabels() Method
Returns data label settings for the series.
Declaration
public IParetoDataLabels getDataLabels()
Returns
| Type | Description |
|---|---|
| IParetoDataLabels | Data label settings. |
Remarks
Refer to the following help topic for additional information: Customize Chart Data Labels — Presentation API for Java.
getHistogramSeries() Method
Returns the histogram series that supplies values for the Pareto line.
Declaration
public HistogramSeries getHistogramSeries()
Returns
| Type | Description |
|---|---|
| HistogramSeries | The histogram series, or |
setHistogramSeries(HistogramSeries value) Method
Sets the histogram series that supplies values for the Pareto line.
Declaration
public void setHistogramSeries(HistogramSeries value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | HistogramSeries | The histogram series. |