ParetoDataLabel Class
Contains settings for a data label in a Pareto line.
Declaration
public class ParetoDataLabel extends DataLabelEx
Remarks
The ParetoDataLabel class inherits label content and formatting settings from DataLabelEx and DataLabelExBase classes (for example, the ParetoDataLabel.setShowValue(value) method).
To format the data label of an individual point, pass a ParetoDataLabel object to the IParetoDataLabels.setLabel(key, value) method.
Refer to the following help topic for additional information: Customize Chart Data Labels — 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
ParetoDataLabel()
Initializes a new instance of the ParetoDataLabel class.
Declaration
public ParetoDataLabel()
Methods
deepClone() Method
Returns a deep copy of this ParetoDataLabel instance.
Declaration
public ParetoDataLabel deepClone()
Returns
| Type | Description |
|---|---|
ParetoDataLabel |
A deep copy of this |