The Polar Band Series Type
The PolarBandRenderableSeriesπ creates a band or area between two polar curves, displaying the relationship between two sets of yValues on a polar coordinate system.
The JavaScript Polar Band Chart can be found in theΒ SciChart.Js Examples Suite > Polar Band ChartΒ on Github, or our live demo atΒ scichart.com/demo.
Some of IPolarBandRenderableSeriesOptionsπ's key properties include:
- dataSeriesπ - The XyyDataSeriesπ containing
xValues,yValues, andy1Valuesarrays. - fillπ - Fill color where Y is greater than Y1
- fillY1π - Fill color where Y1 is greater than Y
- strokeπ - Stroke color for the Y line
- strokeY1π - Stroke color for the Y1 line
- strokeThicknessπ - Thickness of the stroke lines
- interpolateLineπ - When true, line segments draw as arcs instead of straight lines
- scaleGradientToYRangeπ - Controls gradient scaling behavior for radial axis
- fillLinearGradientπ - Linear gradient params where Y is greater than Y1
- fillLinearGradientY1π - Linear gradient params where Y1 is greater than Y
- paletteProviderπ - Custom coloring provider for dynamic styling
Examplesβ
Basic Polar Band Seriesβ
const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(divElementId, {
theme: new SciChartJsNavyTheme()
});
const angularXAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Angular,
visibleRange: new NumberRange(0, 8),
drawMinorGridLines: false
});
sciChartSurface.xAxes.add(angularXAxis);
const radialYAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Radial,
drawMinorGridLines: false,
labelPrecision: 0,
autoTicks: false,
majorDelta: 1,
innerRadius: 0.2
});
sciChartSurface.yAxes.add(radialYAxis);
// Define the polar band series
const baiscBand = new PolarBandRenderableSeries(wasmContext, {
dataSeries: new XyyDataSeries(wasmContext, {
xValues: [0, 1, 3, 4, 5, 6],
yValues: [1, 2, 3, 4, 5, 6],
y1Values: [6, 5, 1, 5, 4, 2]
}),
stroke: "rgba(200,200,30,1)", // yellow
fill: "rgba(200,200,30,0.3)", // thin yellow
strokeY1: "rgba(200,120,160,1)", // pink
fillY1: "rgba(200,120,160,0.3)", // thin pink
strokeThickness: 4,
interpolateLine: false
});
sciChartSurface.renderableSeries.add(baiscBand);
In the code above:
- 2 Polar Band Series instances are created and added to the
sciChartSurface.renderableSeriescollection. - We set the strokeπ, strokeY1π for the yValues and y1Values respectively, and then fillπ and fillY1π, for when
Y > Y1and vice versa. - We assign an XyyDataSeriesπ which stores X, Y and Y1 value arrays.
Gradient Fills in Polar Band Seriesβ
To use Gradient Fills with a PolarBandRenderableSeriesπ, you need to set the fillLinearGradientπ & fillLinearGradientY1π properties with a GradientParamsπ object: a type which defines gradients by a number of TGradientStopπ objects inside an array and a start and end Pointπ.
const gradientBand = new PolarBandRenderableSeries(wasmContext, {
dataSeries: new XyyDataSeries(wasmContext, {
xValues: [0, 1, 2, 3, 4, 5],
yValues: [7, 4, 1, 5, 6, 7],
y1Values: [2, 5, 7, 3, 8, 2]
}),
stroke: "white",
strokeY1: "white",
strokeThickness: 2,
fillLinearGradient: new GradientParams(new Point(0, 0), new Point(0, 1), [
{ color: "#FF9999", offset: 0 },
{ color: "#FF2222", offset: 1 }
]),
// This one is for gradient where Y1 values are greater than Y2 values
fillLinearGradientY1: new GradientParams(new Point(0, 0), new Point(0, 1), [
{ color: "#2222FF", offset: 0 },
{ color: "#9999FF", offset: 1 }
]),
interpolateLine: true,
scaleGradientToYRange: false // set to true to have global gradient depending on Y axis range
});
sciChartSurface.renderableSeries.add(gradientBand);
In the code above:
- We create a GradientParamsπ object with 2 gradient stops, and set the start and end points of the gradient.
- We set scaleGradientToYRangeπ to
trueto make the gradient scale to the Y range of the data for each band segment. - The interpolateLineπ flag is set to
trueto make the band wrap around the angular axes in a circular fashion.
PaletteProvider for Polar Band Seriesβ
By extending DefaultPaletteProviderπ you can create a custom palette for your Polar Band Series, to achieve dynamic coloring based on data values. See more about this topic here Palette Provider API - Polar Band Series.