SciChart Android 2D Charts API > 2D Chart Types > The Mountain (Area) Series Type
The Mountain (Area) Series Type

Mountain (Area) Series can be created using the FastMountainRenderableSeries type.

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

Mountain Series Features

The FastMountainRenderableSeries class allows to specify Area brush and Stroke pen. Please refer to the articles under the Styling and Theming section to learn more about Brushes and Pens used in SciChart.

It is possible to define the ZeroLineY baseline position for a Mountain Series.  All data points that have Y value less than ZeroLineY will appear downward, else - upward.

Those values can be assigned via the corresponding methods, setAreaStyle(), setStrokeStyle(), and setZeroLineY().

Note:

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.

Digital (Step) Mountain Series

Also, FastMountainRenderableSeries can be configured to draw a Digital (Step) Mountain Series. For this, call the setIsDigitalLine() method, passing in True.

Create a Mountain Series

To create a Mountain Series, use the following code:

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

// Create a PenStyle for Stroke
PenStyle strokeStyle = new SolidPenStyle(0xAAFFC9A8, true, 2, null);

// Create a BrushStyle for Fill
BrushStyle fillStyle = new LinearGradientBrushStyle(0, 0, 0, 1, 0xAAFF8D42, 0x88090E11);

// Create and configure the Mountain Chart Series
FastMountainRenderableSeries mountainSeries = new FastMountainRenderableSeries();
mountainSeries.setStrokeStyle(strokeStyle);
mountainSeries.setAreaStyle(fillStyle);

// Create a DataSeries for the chart series
IXyDataSeries<Double, Double> dataSeries = new XyDataSeries<>(Double.class, Double.class);
// Assume some data has been added to the dataSeries here
// dataSeries.append(X, Y);

// Assign the dataSeries to the chart series
mountainSeries.setDataSeries(dataSeries);

// Add the chart series to the RenderableSeriesCollection of the surface
Collections.addAll(surface.getRenderableSeries(), mountainSeries); 

The same can be achieved using Chart Builders:

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

// Create a DataSeries for the chart series
IXyDataSeries<Double, Double> dataSeries = new XyDataSeries(Double.class, Double.class);
// Assume some data has been added to the dataSeries here
// dataSeries.append(X, Y);

// Create and configure the Mountain Chart Series
final FastMountainRenderableSeries mountainSeries = sciChartBuilder.newMountainSeries()
        .withDataSeries(dataSeries)
        .withStrokeStyle(0xAAFFC9A8)
        .withAreaFillLinearGradientColors(0xAAFF8D42,0x88090E11)
        .build();

// Add the chart series to the RenderableSeriesCollection of the surface
Collections.addAll(surface.getRenderableSeries(), mountainSeries);

Render a Gap in a Mountain Series

It is possible to show a gap in a Renderable 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 FastMountainRenderableSeries, 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 Mountain Series

Every data point of a Mountain Series can be marked with a PointMarker. To add Point Markers to a Mountain Series, call the setPointMarker() method. For more info and code examples, please refer to the PointMarkers API article.

Paint Area Parts With Different Colors

This can be achieved with the PaletteProvider API. It allows to specify a color for every data point in a series. This will result in a Mountain Series with colored stripes:

 

To achieve this, a custom IFillPaletteProvider  or IStrokePaletteProvider has to be provided to the setPaletteProvider() method. Please refer to the PaletteProvider API article for more info.

See Also