ScatterChartView Class
Contains settings that apply to scatter series in a chart view.
Declaration
public class ScatterChartView extends ColorfulChartView
Remarks
When you add a ScatterSeries object to a chart, the chart creates a ScatterChartView object for the series. Call the Chart.getViews() method to access chart views.
Call the setStyle(ScatterChartStyle value) method to specify the scatter chart style.
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
ScatterChartView()
Initializes a new instance of the ScatterChartView class.
Declaration
public ScatterChartView()
Methods
getChartType() Method
Returns the chart type of the view.
Declaration
public ChartType getChartType()
Returns
| Type | Description |
|---|---|
| ChartType |
|
getDataLabels() Method
Returns data label settings for all series in the view.
Declaration
public IScatterDataLabels getDataLabels()
Returns
| Type | Description |
|---|---|
| IScatterDataLabels | Data label settings. |
Remarks
Call the ScatterSeries.getDataLabels() method to access data label settings for an individual series.
Refer to the following help topic for additional information: Customize Chart Data Labels — Presentation API for Java.
getStyle() Method
Returns the scatter chart style.
Declaration
public ScatterChartStyle getStyle()
Returns
| Type | Description |
|---|---|
| ScatterChartStyle | The scatter chart style. |
setStyle(ScatterChartStyle value) Method
Sets the scatter chart style.
Declaration
public void setStyle(ScatterChartStyle value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | ScatterChartStyle | The scatter chart style. |
Exceptions
| Type | Description |
|---|---|
| NullPointerException | Thrown if the |
Remarks
The setStyle(value) method accepts the following values:
| Value | Description |
|---|---|
| LINE_MARKER | Indicates that the scatter chart connects data points with straight lines and displays markers. |
| LINE | Indicates that the scatter chart connects data points with straight lines and does not display markers. |
| MARKER | Indicates that the scatter chart displays markers and does not connect data points with lines. |
| SMOOTH | Indicates that the scatter chart connects data points with smooth lines and does not display markers. |
| SMOOTH_MARKER | Indicates that the scatter chart connects data points with smooth lines and displays markers. |
If you do not call the setStyle(value) method, the API uses ScatterChartStyle.LINE_MARKER.
Note
When the API saves a presentation, it saves SMOOTH and SMOOTH_MARKER styles as SMOOTH_MARKER and other styles as LINE_MARKER. To hide series lines in the saved document, pass a ChartElement object with a NoFill outline fill to the ScatterSeries.setProperties(value) method. To hide markers, pass a Marker object with the MarkerStyle.NONE symbol to the ScatterSeries.setMarker(value) method.
Call the ScatterSeries.setSmooth(value) method to specify whether an individual series connects data points with smooth lines.