ChartStringData Class
String chart data specified in code.
Declaration
public class ChartStringData extends JavaObject implements IChartArgumentData
Remarks
Pass a ChartStringData object to a series method that specifies arguments (for example, DataSeriesExBase.setArguments(value) or SeriesBase.setArguments(value)) to specify string arguments (categories) in code. To bind series arguments to chart data cells, use a ChartDataReference object instead.
Refer to the following help topic for additional information: Load Data into 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:

Implements
Inherited Members
Inheritance
ChartStringData(Iterable<String> values)
Initializes a new instance of the ChartStringData class with the specified values.
Declaration
public ChartStringData(Iterable<String> values)
Parameters
| Name | Type | Description |
|---|---|---|
| values | java.lang.Iterable<java.lang.String> | String values. |
Exceptions
| Type | Description |
|---|---|
| ArgumentNullException | Thrown if the |
Methods
cloneArgumentData() Method
Creates a copy of the string data.
Declaration
public IChartArgumentData cloneArgumentData()
Returns
| Type | Description |
|---|---|
| IChartArgumentData | A copy of the string data. |
getExpression(IChartDataContext context) Method
Returns the reference expression of the data.
Declaration
public String getExpression(IChartDataContext context)
Parameters
| Name | Type | Description |
|---|---|---|
| context | IChartDataContext | An object that returns sheet names for sheet indexes. |
Returns
| Type | Description |
|---|---|
| String |
|
getLevelCount() Method
Returns the number of hierarchy levels in the data.
Declaration
public int getLevelCount()
Returns
| Type | Description |
|---|---|
| int |
|
getType() Method
Returns the chart data type.
Declaration
public ChartDataType getType()
Returns
| Type | Description |
|---|---|
| ChartDataType |
|
getValues() Method
Returns the string values.
Declaration
public List<String> getValues()
Returns
| Type | Description |
|---|---|
| java.util.List<java.lang.String> | A read-only list of string values. |
makeCopy() Method
Creates a copy of the string data.
Declaration
public ChartStringData makeCopy()
Returns
| Type | Description |
|---|---|
ChartStringData |
A copy of the string data. |