The Polar Column Chart Type
The PolarColumnRenderableSeriesπ creates columns in a polar coordinate system, displaying data as vertical bars positioned at specific angles and radial distances from the center, or as angular bars drawn around the center. This chart type is ideal for visualizing cyclic data or data with angular relationships.
The JavaScript Polar Column Chart can be found in theΒ SciChart.Js Examples Suite > Polar Column ChartΒ on Github, or our live demo atΒ scichart.com/demo.
Propertiesβ
Some of IPolarColumnRenderableSeriesOptionsπ's key properties include:
- dataSeriesπ - The XyDataSeriesπ, XyxDataSeriesπ or XyxyDataSeriesπ defining the data points of the columns.
- fillπ - Fill color for the columns
- strokeπ - Stroke color for column borders
- strokeThicknessπ - Thickness of the column borders
- dataPointWidthπ - Width of each column
- dataPointWidthModeπ - How the
dataPointWidthis applied, see EDataPointWidthModeπ for all options. - columnXModeπ - How x values are interpreted for column positioning. See EColumnModeπ for more info.
- defaultY1π - Sets the zero line - where the column starts at defaulting at
0, but is only needed for XyDataSeriesπ - dataLabelsπ - Configuration for data labels on columns
- paletteProviderπ - Custom coloring provider for dynamic styling
Examplesβ
Basic Angular Polar Column Seriesβ
// Demonstrates how to create a basic polar column chart using SciChart.js
const {
SciChartPolarSurface,
PolarNumericAxis,
SciChartJsNavyTheme,
PolarColumnRenderableSeries,
EPolarAxisMode,
EAxisAlignment,
EPolarLabelMode,
NumberRange,
XyDataSeries,
} = SciChart;
// or, for npm, import { SciChartSurface, ... } from "scichart"
const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(divElementId, {
theme: new SciChartJsNavyTheme(),
});
const angularXAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Angular, // Angular == "goes around the center, drawn by arcs"
axisAlignment: EAxisAlignment.Top,
visibleRange: new NumberRange(0, 20),
flippedCoordinates: true, // go clockwise
});
sciChartSurface.xAxes.add(angularXAxis);
const radialYAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Radial, // Radial == "goes from center out, drawn by straight lines"
axisAlignment: EAxisAlignment.Right,
visibleRange: new NumberRange(0, 6),
drawLabels: false, // don't draw labels
innerRadius: 0.1, // donut hole
});
sciChartSurface.yAxes.add(radialYAxis);
const polarColumn = new PolarColumnRenderableSeries(wasmContext, {
dataSeries: new XyDataSeries(wasmContext, {
xValues: Array.from({ length: 20 }, (_, i) => i),
yValues: Array.from({ length: 20 }, (_, i) => Math.random() * 5 + 1),
}),
stroke: "white",
fill: "#0088FF66",
strokeThickness: 2,
dataPointWidth: 1,
dataLabels: { // optionally - add data labels
color: "white",
style: {
fontSize: 14,
fontFamily: "Default",
},
polarLabelMode: EPolarLabelMode.Parallel,
},
});
sciChartSurface.renderableSeries.add(polarColumn);
In the code above:
- A PolarColumnRenderableSeriesπ instance is created and added to the
sciChartSurface.renderableSeriescollection. - We assign an XyDataSeriesπ which stores X and Y value arrays.
- We set the strokeπ, fillπ, strokeThicknessπ, and dataPointWidthπ properties.
- Optional dataLabelsπ are configured to display values on each column.
Polar Radial Polar Column Seriesβ
The same renderable series can be used as radial columns by swapping the axis configurations. This creates columns that extend radially outward from the center:
const radialXAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Radial, // radial axis -> xAxis
axisAlignment: EAxisAlignment.Right,
innerRadius: 0.1,
startAngle: 0,
});
sciChartSurface.xAxes.add(radialXAxis);
const angularYAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Angular, // angular axis -> yAxis
axisAlignment: EAxisAlignment.Top,
visibleRange: new NumberRange(0, 10),
useNativeText: true,
startAngle: 0,
totalAngle: Math.PI, // 180 degrees
flippedCoordinates: true, // go clockwise
});
sciChartSurface.yAxes.add(angularYAxis);
// The Polar renderable series do not require extra config, only control the Angular / Radial look.
const polarColumn = new PolarColumnRenderableSeries(wasmContext, {
dataSeries: new XyDataSeries(wasmContext, {
xValues: [1, 2, 3, 4, 5, 6],
yValues: [6.6, 8.7, 3.5, 5.7, 3.8, 6.8]
}),
stroke: "white",
fill: "#0088FF66",
strokeThickness: 2,
dataPointWidth: 0.8,
dataLabels: { // optionally - add data labels
color: "white",
style: {
fontSize: 14,
},
polarLabelMode: EPolarLabelMode.Parallel,
labelYPositionMode: EColumnDataLabelPosition.Outside,
},
});
sciChartSurface.renderableSeries.add(polarColumn);
In the code above:
- The xAxisπ is configured with EPolarAxisMode.Radialπ to control the radial positioning.
- The yAxisπ is configured with EPolarAxisMode.Angularπ to control the angular positioning.
- The axisAlignmentπ is also swapped.
- (optional) The angular axis now has 180 degrees (1 * PI radians), meaning a half-circle, due to the totalAngleπ.
- (optional) The angular axis also grows clockwise, via flippedCoordinatesπ.
Column Mode Configurationβ
The columnXModeπ property controls how columns are positioned and sized along the X-axis:
const polarColumn = new PolarColumnRenderableSeries(wasmContext, {
dataSeries: new XyxDataSeries(wasmContext, {
xValues: [ 1, 2, 3, 5, 6.5, 9.5],
x1Values: [1.5, 2.5, 4.5, 6, 9, 10 ], // columns go from 1 -> 1.5 // 2 -> 2.5, etc
yValues: [6.6, 8.7, 3.5, 5.7, 3.8, 6.8], // dictates the height of the column
}),
columnXMode: EColumnMode.StartEnd, // go from start to end (x to x1)
stroke: "white",
fill: "#0088FF66",
strokeThickness: 2,
});
sciChartSurface.renderableSeries.add(polarColumn);
In the code above:
- We use an XyxDataSeriesπ with
xValues,x1Values, andyValuesarrays. - The columnXModeπ is set to EColumnMode.StartEndπ to define column start and end positions.
- Each column extends from its
xValueto itsx1Value, allowing for variable-width columns.
- Startπ, Midπ - work with XyDataSeriesπ
- StartEndπ, StartWidthπ, and MidWidthπ - require XyxDataSeriesπ or XyxyDataSeriesπ
PaletteProvider for Polar Column Seriesβ
By extending DefaultPaletteProviderπ you can create a custom palette for your Polar Column Series, to achieve dynamic coloring based on data values. See more about this topic here Palette Provider API - Polar Column Series.