Skip to main content

The Digital (Step) Band Series Type

A Digital Band Series, or High-Low Fill between two Digital or Step lines can be created using the FastBandRenderableSeries📘 type.

tip
Above: The JavaScript Digital Band Chart example from the SciChart.js Demo

Create a Digital Band Series

To create a Javascript Digital Band Chart with SciChart.js, use the following code:

// Demonstrates how to create a band chart using SciChart.js
const {
SciChartSurface,
NumericAxis,
FastBandRenderableSeries,
XyyDataSeries,
SciChartJsNavyTheme
} = SciChart;
// or, for npm, import { SciChartSurface, ... } from "scichart"

const { wasmContext, sciChartSurface } = await SciChartSurface.create(divElementId, {
theme: new SciChartJsNavyTheme()
});

sciChartSurface.xAxes.add(new NumericAxis(wasmContext));
sciChartSurface.yAxes.add(new NumericAxis(wasmContext));

const xValues = [];
const yValues = [];
const y1Values = [];
const POINTS = 100;
const STEP = (3 * Math.PI) / POINTS;
for (let i = 0; i <= POINTS; i++) {
const k = 1 - i / (POINTS * 2);
xValues.push(i);
yValues.push(Math.sin(i * STEP) * k * 0.7);
y1Values.push(Math.cos(i * STEP) * k);
}

const bandSeries = new FastBandRenderableSeries(wasmContext, {
dataSeries: new XyyDataSeries(wasmContext, {
xValues,
yValues,
y1Values
}),
stroke: "#F48420",
strokeY1: "#50C7E0",
fill: "#F4842033",
fillY1: "#50C7E033",
strokeThickness: 2,
// optional parameter defines a step-line
isDigitalLine: true
});
sciChartSurface.renderableSeries.add(bandSeries);

This results in the following output:

In the code above:

Render a Gap in a Digital Band Series

tip

It is possible to have null points or gaps in a Digital Band Series by passing a data point with a NaN value as the Y value. Please refer to the Common Series Features - Draw Gaps in Series article for more details.

Add Point Markers onto a Band Series

It is possible to put scatter point markers of varying type (Ellipse, Square, Triangle, Cross, Custom) onto a Band Series via the PointMarker API. To learn more, see the documentation page Drawing PointMarkers on Series.

tip

To learn more about the types of Point Marker in SciChart.js, see the Point Markers API documentation.

There is also a dedicated Scatter Series type and a Bubble Series type with some more options.

Painting Band Segments with Different Colors

tip

It is possible to define the colour of band segments individually using the PaletteProvider API.

For more info on how to do this, see the PaletteProvider - Per-point colouring of Band Charts documentation page.

See Also