ScatterSeries Class
A scatter series in a standard chart.
Declaration
public class ScatterSeries extends SeriesBase
Remarks
Add a ScatterSeries object to the Chart.getSeries() collection to create a scatter chart. The chart creates a ScatterChartView object for the series.
A scatter series displays numeric arguments (X values) and values (Y values). Call ScatterSeries.setArguments(value) and ScatterSeries.setValues(value) methods to specify the data. Call the ScatterSeries.setMarker(value) method to specify markers and the ScatterSeries.setProperties(value) method to specify series line settings.
Refer to the following help topic for additional information: Create Standard Charts — Presentation API for Java.
Example
Create a Scatter Chart with a Trend Line
The following code snippet creates a scatter chart that displays circle markers without lines, adds a linear trend line, and displays data labels above data points:
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.
Chart chart = new Chart();
chart.setWidth(presentation.getSlideSize().getWidth());
chart.setHeight(presentation.getSlideSize().getHeight());
slide.getShapes().add(chart);
// Create a scatter series: advertising spend (X) and sales (Y).
ScatterSeries series = new ScatterSeries();
series.setText("Sales");
series.setArguments(new ChartNumericData(List.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)));
series.setValues(new ChartNumericData(List.of(12.0, 15.0, 21.0, 24.0, 30.0, 33.0)));
chart.getSeries().add(series);
// Display circle markers without lines.
Marker marker = new Marker();
marker.setSymbol(MarkerStyle.CIRCLE);
marker.setSize(9);
series.setMarker(marker);
OutlineStyle noLine = new OutlineStyle();
noLine.setFill(new NoFill());
ChartElement seriesProperties = new ChartElement();
seriesProperties.setOutlineStyle(noLine);
series.setProperties(seriesProperties);
// Add a linear trend line.
TrendLine trendLine = new TrendLine();
trendLine.setType(TrendLineType.LINEAR);
series.setTrendLine(trendLine);
// Display values above data points.
ScatterChartView view = (ScatterChartView) chart.getViews().get(0);
view.getDataLabels().setShowValue(true);
view.getDataLabels().setLabelPosition(ScatterDataLabelPosition.TOP);
// 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
ScatterSeries()
Initializes a new instance of the ScatterSeries class.
Declaration
public ScatterSeries()
Methods
getAxisGroup() Method
Returns the axis group that displays the series.
Declaration
public ChartAxisGroupType getAxisGroup()
Returns
| Type | Description |
|---|---|
| ChartAxisGroupType | The axis group. |
getCustomDataPoints() Method
Returns appearance settings for individual series data points.
Declaration
public IDataPointDictionary getCustomDataPoints()
Returns
| Type | Description |
|---|---|
| IDataPointDictionary | A dictionary that maps zero-based data point indexes to data point settings. |
Remarks
To customize an individual data point, add a DataPoint object to the dictionary that the getCustomDataPoints() method returns. The dictionary key is the zero-based index of the data point.
getDataLabels() Method
Returns data label settings for the series.
Declaration
public IScatterDataLabels getDataLabels()
Returns
| Type | Description |
|---|---|
| IScatterDataLabels | Data label settings. |
Remarks
Call the ScatterChartView.getDataLabels() method to access data label settings for all series in a scatter chart view.
Refer to the following help topic for additional information: Customize Chart Data Labels — Presentation API for Java.
getDataLabelsRange() Method
Returns a reference to cells that contain text for series data labels.
Declaration
public IChartDataReference getDataLabelsRange()
Returns
| Type | Description |
|---|---|
| IChartDataReference | A reference to the cell range, or |
getErrorBars() Method
Returns the collection of error bars for the series.
Declaration
public IErrorBarCollection getErrorBars()
Returns
| Type | Description |
|---|---|
| IErrorBarCollection | The collection of error bars. |
Remarks
Add an ErrorBar object to the collection to display error bars for series values.
Refer to the following help topic for additional information: Add Error Bars and Trend Lines to Charts — Presentation API for Java.
getMarker() Method
Returns marker settings for series data points.
Declaration
public Marker getMarker()
Returns
| Type | Description |
|---|---|
| Marker | Marker settings. |
getSmooth() Method
Returns whether the series connects data points with smooth lines.
Declaration
public @Nullable Boolean getSmooth()
Returns
| Type | Description |
|---|---|
|
getTrendLine() Method
Returns the trend line of the series.
Declaration
public TrendLine getTrendLine()
Returns
| Type | Description |
|---|---|
| TrendLine | The trend line, or |
setAxisGroup(ChartAxisGroupType value) Method
Sets the axis group that displays the series.
Declaration
public void setAxisGroup(ChartAxisGroupType value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | ChartAxisGroupType | The axis group. |
Remarks
The setAxisGroup(value) method accepts the following values:
| Value | Description |
|---|---|
| PRIMARY | Indicates primary axes. |
| SECONDARY | Indicates secondary axes. |
If you do not call the setAxisGroup(value) method, the series uses primary axes. If you call the setAxisGroup(ChartAxisGroupType.SECONDARY) method, the chart moves the series to a separate chart view and creates secondary axes for this view.
Refer to the following help topics for additional information:
setDataLabelsRange(IChartDataReference value) Method
Sets a reference to cells that contain text for series data labels.
Declaration
public void setDataLabelsRange(IChartDataReference value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | IChartDataReference | A reference to the cell range, or |
Remarks
When you assign a cell range to a series in a chart, the API calls the setShowDataLabelRange(true) method of the object that the series getDataLabels() method returns. Each data label displays the value of the cell with the same index in the range. Call the setDataLabelsRange(null) method to remove cell values from data labels.
setMarker(Marker value) Method
Sets marker settings for series data points.
Declaration
public void setMarker(Marker value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | Marker | Marker settings. |
Remarks
A new series has a marker with the MarkerStyle.AUTO symbol and size 5. To hide markers, pass a Marker object with the MarkerStyle.NONE symbol to the setMarker(value) method.
To specify the marker of an individual data point, call the DataPoint.setMarker(value) method.
setSmooth(@Nullable Boolean value) Method
Sets whether the series connects data points with smooth lines.
Declaration
public void setSmooth(@Nullable Boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value |
|
Remarks
If you do not call the setSmooth(value) method, the series does not specify this setting, and the getSmooth() method returns null.
Call the ScatterChartView.setStyle(value) method to specify the style for all series in a scatter chart view.
setTrendLine(TrendLine value) Method
Sets the trend line of the series.
Declaration
public void setTrendLine(TrendLine value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | TrendLine | The trend line, or |
Remarks
Refer to the following help topic for additional information: Add Error Bars and Trend Lines to Charts — Presentation API for Java.