SciChart Android 2D Charts API > 2D Chart Types > The Band Series type
The Band Series type

Band Series can be created using the FastBandRenderableSeries type.

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

Band Series Features

High-Low Fill or Band Series are provided by the FastBandRenderableSeries type. This accepts data in a triplet form  (X, Y1, Y2) and renders two lines with a polygon, which changes color depending on whether Y1>Y2 or vice versa.

The FastBandRenderableSeries class allows to specify Fill, FillY1 brushes and Stroke, StrokeY1 pens. Please refer to the articles under the Styling and Theming section to learn more about Brushes and Pens used in SciChart.

Digital (Step) Band Series

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

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.

Create a Band Series

To create a Band Series, use the following code:

// Create a Band Series
FastBandRenderableSeries bandSeries = new FastBandRenderableSeries<>();

// Create PenStyles for Stroke
PenStyle strokeStyle = new SolidPenStyle(0xFFFF1919, true, 2, null);
PenStyle strokeY1Style = new SolidPenStyle(0xFF279B27, true, 2, null);

// Apply the StrokeStyle
bandSeries.setStrokeStyle(strokeStyle);
bandSeries.setStrokeY1Style(strokeY1Style);

// Create BrushStyles for Fill
BrushStyle brushStyle = new SolidBrushStyle(0x33279B27);
BrushStyle brushY1Style = new SolidBrushStyle(0x33FF1919);

// Apply the BrushStyle
bandSeries.setFillBrushStyle(brushStyle);
bandSeries.setFillY1BrushStyle(brushY1Style);

// Create a DataSeries for the Scatter Series
IXyyDataSeries<Double, Double> dataSeries = new XyyDataSeries<>(Double.class, Double.class);

// Assume some data has been added to the dataSeries here
// dataSeries.append(X, Y, Y1);

// Assign the dataSeries to the RenderableSeries
bandSeries.setDataSeries(dataSeries);

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

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
IXyyDataSeries<Double, Double> dataSeries = new XyyDataSeries(Double.class, Double.class);
// Assume some data has been added to the dataSeries here
// dataSeries.append(X, Y, Y1);

// Create and configure a Band Series
final FastBandRenderableSeries renderableSeries = sciChartBuilder.newBandSeries()
        .withDataSeries(dataSeries)
        .withFillColor(0x33279B27).withFillY1Color(0x33FF1919)
        .withStrokeStyle(0xFFFF1919).withStrokeY1Style(0xFF279B27)
        .build();

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

Adding PointMarkers onto a Band Series

Every pair of (X, Y) and (X, Y1) data points of a Band Series can be marked with a PointMarker. Please refer to the PointMarkers API article for more info.

To add Point Markers to a Band Series, use the following code:

// Create a Triangle PointMarker instance
 IPointMarker pointMarker = new TrianglePointMarker();
 pointMarker.setSize(40,40);
// Create a PenStyle for Stroke
 PenStyle strokeStyle = new SolidPenStyle(ColorUtil.Green, true, 2, null);
 pointMarker.setStrokeStyle(strokeStyle);
// Create a BrushStyle for Fill
 BrushStyle fillStyle = new SolidBrushStyle(ColorUtil.Red);
 pointMarker.setFillStyle(fillStyle);
// Apply the PointMarker to a Band Series
 IRenderableSeries bandSeries= new FastBandRenderableSeries();
 bandSeries.setPointMarker(pointMarker);

 

See Also