QuartileCalculationMode Enum
Lists quartile calculation methods for box and whisker series.
Declaration
public enum QuartileCalculationMode extends Enum<QuartileCalculationMode> implements IIntEnum
Members
| Name | Description |
|---|---|
EXCLUSIVE
|
Indicates that the quartile calculation excludes the median from both halves of the data set. |
INCLUSIVE
|
Indicates that the quartile calculation includes the median in both halves of the data set. |
fromValue(int value)
|
Returns the |
getName()
|
Returns the name of the |
getValue()
|
Returns the integer value of the |
toString()
|
Returns the string representation of the |
valueOf(String name)
|
Returns the |
values()
|
Returns an array of all |
Remarks
Call the BoxAndWhiskerSeries.getQuartileCalculationMode() method to get the quartile calculation method of a box and whisker series. Call the BoxAndWhiskerSeries.setQuartileCalculationMode(value) method to specify the method.
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 Box and Whisker Chart
The following code snippet creates a box and whisker chart with two series and two categories, displays mean markers, mean lines, and outliers, and applies the exclusive quartile calculation method:
import java.io.*;
import java.nio.file.*;
import java.util.*;
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);
// Each value belongs to the category with the same index (five Math scores, then five Science scores).
List<String> subjects = new ArrayList<>(Collections.nCopies(5, "Math"));
subjects.addAll(Collections.nCopies(5, "Science"));
// Add a box and whisker series for each team.
String[] teams = { "Team A", "Team B" };
List<List<Double>> scores = List.of(
List.of(62.0, 70.0, 74.0, 80.0, 98.0, 58.0, 66.0, 71.0, 75.0, 82.0),
List.of(55.0, 64.0, 69.0, 73.0, 79.0, 61.0, 68.0, 72.0, 77.0, 85.0));
for (int i = 0; i < teams.length; i++) {
BoxAndWhiskerSeries series = new BoxAndWhiskerSeries();
series.setText(teams[i]);
series.setArguments(new ChartStringData(subjects));
series.setValues(new ChartNumericData(scores.get(i)));
// Display mean markers, mean lines, and outliers, and specify the quartile calculation method.
series.setShowMeanMarkers(true);
series.setShowMeanLine(true);
series.setShowOutlierPoints(true);
series.setQuartileCalculationMode(QuartileCalculationMode.EXCLUSIVE);
chart.getSeries().add(series);
}
// 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:
