SciChart Android 2D Charts API > 2D Chart Types > The Line Series Type
The Line Series Type

Line Series can be created using the FastLineRenderableSeries type.

Examples for the Line Series can be found in the SciChart Android Examples Suite

Create a Line Series

To create a FastLineRenderableSeries, use the following code:

// Assume a surface has been created and configured somewhere
ISciChartSurface surface;

FastLineRenderableSeries lineSeries = new FastLineRenderableSeries();

IXyDataSeries<Double, Double> dataSeries = new XyDataSeries(Double.class, Double.class);
// Assume some data has been added to the dataSeries here
// dataSeries.append(...);

// Assign the dataSeries to the Line RenderableSeries

// Create a Stroke Pen and assign it
PenStyle strokePen = new SolidPenStyle(ColorUtil.argb(0xFF, 0x27, 0x9B, 0x27), true, 2f, null);

// Add the Line RenderableSeries to the RenderableSeriesCollection of the surface
Collections.addAll(surface.getRenderableSeries(), lineSeries);

In the code above, a Line Series instance is created. It is assigned to draw the data that is provided by the DataSeries assigned to it. The line is drawn with a Pen provided by the PenStyle instance. Finally, the Line Series is added to the RenderableSeriesCollection of a SciChartSurface.

Using Chart Builders

Similarly, a Line Series can be created using Chart Builders:

// Create and configure a Line Series
FastLineRenderableSeries lineSeries = sciChartBuilder.newLineSeries()
                        .withStrokeStyle(ColorUtil.argb(0xFF, 0x27, 0x9B, 0x27))

// Add the Line RenderableSeries to the RenderableSeriesCollection of the surface
Collections.addAll(surface.getRenderableSeries(), lineSeries);

Please refer to the corresponding documentation section to learn more about the DataSeries API and Styling API.


In multi axis scenarios, a series has to be assigned to particular X and Y axes. This can be done passing the axes IDs to the setXAxisId(), setYAxisId() methods of the series.

Render a Gap in a Line Series

It is possible to show a gap in a Line Series by passing a data point with a NaN value as the Y value. Please refer to the Common RenderableSeries Features article for more details. The FastLineRenderableSeries, however, allows to specify how a gap should appear. There are several modes defined in the LineDrawMode enumeration, which can be applied via the setDrawNaNAs() method.

Add Point Markers onto a Line Series

Every data point of a Line Series can be marked with a PointMarker. To add Point Markers to the Line Series, use the following code:

// Create a Triangle PointMarker instance
IPointMarker pointMarker = new TrianglePointMarker();
// Create a PenStyle for Stroke
PenStyle strokeStyle = new SolidPenStyle(ColorUtil.Green, true, 2, null);
// Create a BrushStyle for Fill
BrushStyle fillStyle = new SolidBrushStyle(ColorUtil.Red);
// Apply the PointMarker to a LineSeries
IRenderableSeries lineSeries = new FastLineRenderableSeries();

To learn more about Point Markers, please refer to the PointMarkers API article.


This feature can be used to create a Scatter Series, if StrokeStyle contains a transparent Pen.

Paint Line Segments With Different Colors


Such appearance can be achieved with the PaletteProvider API. It allows to change color of Line Series between any two data points. To do this, a custom IStrokePaletteProvider has to be provided to the setPaletteProvider() method:

// Create a PaletteProvider instance and assign it to the Line Series
IPaletteProvider paletteProvider = new ColoredLinePaletteProvider();

Please refer to the PaletteProvider API article for more info.

See Also