LineSeries Class
A line series in a standard chart.
Declaration
public class LineSeries extends LineSeriesBase
Remarks
Add a LineSeries object to the Chart.getSeries() collection to create a line chart. The chart creates a LineChartView object for the series. To stack line series, call the LineChartView.setGrouping(value) method.
Refer to the following help topic for additional information: Create Standard Charts — Presentation API for Java.
Example
Create a Line Chart with Markers and Data Labels
The following code snippet creates a line chart with two series, displays circle markers, smooths the second line, and displays a data label for the last data point of the first series:
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.
Chart chart = new Chart();
chart.setWidth(presentation.getSlideSize().getWidth());
chart.setHeight(presentation.getSlideSize().getHeight());
slide.getShapes().add(chart);
// Add two line series with circle markers.
String[] names = { "2024", "2025" };
double[][] values = { { 12, 18, 15, 21 }, { 14, 16, 22, 25 } };
for (int i = 0; i < names.length; i++) {
LineSeries series = new LineSeries();
series.setText(names[i]);
series.setArguments(new ChartStringData(List.of("Q1", "Q2", "Q3", "Q4")));
series.setValues(new ChartNumericData(List.of(values[i][0], values[i][1], values[i][2], values[i][3])));
Marker marker = new Marker();
marker.setSymbol(MarkerStyle.CIRCLE);
marker.setSize(8);
series.setMarker(marker);
chart.getSeries().add(series);
}
// Smooth the second line.
LineSeries secondSeries = (LineSeries) chart.getSeries().get(1);
secondSeries.setSmooth(true);
// Display the Q4 value of the first series above the data point.
LineDataLabel label = new LineDataLabel();
label.setShowValue(true);
label.setLabelPosition(LineDataLabelPosition.TOP);
LineSeries firstSeries = (LineSeries) chart.getSeries().get(0);
firstSeries.getDataLabels().setLabel(3, label);
// 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
LineSeries()
Initializes a new instance of the LineSeries class.
Declaration
public LineSeries()
Methods
getAxisGroup() Method
Returns the axis group that displays the series.
Declaration
public ChartAxisGroupType getAxisGroup()
Returns
| Type | Description |
|---|---|
| ChartAxisGroupType | The axis group. |
getDataLabels() Method
Returns data label settings for the series.
Declaration
public ILineDataLabels getDataLabels()
Returns
| Type | Description |
|---|---|
| ILineDataLabels | Data label settings. |
Remarks
Call the LineChartView.getDataLabels() method to access data label settings for all series in a line 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.
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.
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.