WaterfallSeries Class
A series in a waterfall chart.
Declaration
public class WaterfallSeries extends DataSeriesExBase
Remarks
Add a WaterfallSeries object to the ChartEx.getSeries() collection to create a waterfall chart.
A waterfall chart displays each value as an increase or decrease from the previous total. Call the getSubtotalDataPoints() method to specify data points that display totals.
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 Waterfall Chart with Total Columns
The following code snippet creates a waterfall chart, displays the first and last data points as totals, displays connector lines, and adds a chart title:
import java.io.*;
import java.nio.file.*;
import java.util.List;
import com.devexpress.docs.office.*;
import com.devexpress.docs.presentation.*;
import com.devexpress.system.drawing.*;
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 waterfall series and specify data.
WaterfallSeries series = new WaterfallSeries();
series.setText("Cash Flow");
series.setArguments(new ChartStringData(List.of("Start", "Jan", "Feb", "Mar", "End")));
series.setValues(new ChartNumericData(List.of(10.0, 12.0, -5.0, 8.0, 25.0)));
// Display the first and last points as totals and connect the columns.
series.getSubtotalDataPoints().add(0);
series.getSubtotalDataPoints().add(4);
series.setShowConnectorLines(true);
chart.getSeries().add(series);
// Add a chart title.
TextProperties titleTextProperties = new TextProperties();
titleTextProperties.setFontSize(30f);
titleTextProperties.setFill(new SolidFill(Color.getDarkBlue()));
chart.setTitle(new ChartTitleEx(
new TextArea("Cash Flow", new TextParagraphProperties(titleTextProperties))));
// 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
WaterfallSeries()
Initializes a new instance of the WaterfallSeries class.
Declaration
public WaterfallSeries()
Methods
deepClone() Method
Creates a copy of the waterfall series.
Declaration
public WaterfallSeries deepClone()
Returns
| Type | Description |
|---|---|
WaterfallSeries |
A copy of the waterfall 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 IWaterfallDataLabels getDataLabels()
Returns
| Type | Description |
|---|---|
| IWaterfallDataLabels | Data label settings. |
Remarks
Refer to the following help topic for additional information: Customize Chart Data Labels — Presentation API for Java.
getShowConnectorLines() Method
Returns whether the series displays connector lines between columns.
Declaration
public boolean getShowConnectorLines()
Returns
| Type | Description |
|---|---|
| boolean |
|
getSubtotalDataPoints() Method
Returns indexes of data points that display totals.
Declaration
public ISubtotalDataPointCollection getSubtotalDataPoints()
Returns
| Type | Description |
|---|---|
| ISubtotalDataPointCollection | Zero-based indexes of data points that display totals. |
setShowConnectorLines(boolean value) Method
Sets whether the series displays connector lines between columns.
Declaration
public void setShowConnectorLines(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
Remarks
A new waterfall series does not display connector lines.
setSubtotalDataPoints(List<Integer> value) Method
Sets indexes of data points that display totals.
Declaration
public void setSubtotalDataPoints(List<Integer> value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | java.util.List<java.lang.Integer> | Zero-based indexes of data points that display totals. |
Remarks
A data point that displays a total starts at the horizontal axis. Other data points display increases or decreases from the previous total.
If you call the setSubtotalDataPoints(null) method, the getSubtotalDataPoints() method returns null.