Creates a JavaScript Polar Stacked Mountain Chart using SciChart's powerful JavaScript Charts and its range of features.
import {
PolarMouseWheelZoomModifier,
PolarZoomExtentsModifier,
PolarPanModifier,
XyDataSeries,
PolarNumericAxis,
SciChartPolarSurface,
EPolarAxisMode,
NumberRange,
EAxisAlignment,
EPolarLabelMode,
WaveAnimation,
PolarStackedMountainCollection,
PolarStackedMountainRenderableSeries,
PolarLegendModifier,
} from "scichart";
import { appTheme } from "./appTheme";
const xValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
const MountainsDatasets = [
{
yValues: [2.7, 1.4, 2.3, 2.1, 1.2, 1.5, 2.4, 1.5, 2.7, 1.3],
fillColor: appTheme.DarkIndigo,
},
{
yValues: [3.2, 0.9, 2, 2.5, 1.3, 2.8, 2.1, 2, 1.2, 2.4],
fillColor: appTheme.VividBlue,
},
{
yValues: [0.3, 2.3, 1.7, 3.2, 2, 2.9, 1, 2, 2.1, 1.1],
fillColor: appTheme.VividOrange,
},
{
yValues: [2.1, 1.8, 2.7, 0.5, 2.2, 0.3, 3, 1.6, 2.1, 1],
fillColor: appTheme.VividPink,
},
];
export const drawExample = async (rootElement: string | HTMLDivElement) => {
const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
theme: appTheme.SciChartJsTheme,
});
// add Radial Y axis
const radialYAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Radial,
axisAlignment: EAxisAlignment.Right,
visibleRange: new NumberRange(0, 9),
drawMinorTickLines: false,
drawMajorTickLines: false,
useNativeText: true,
drawMinorGridLines: false,
startAngle: Math.PI / 2,
zoomExtentsToInitialRange: true,
labelPrecision: 0,
});
sciChartSurface.yAxes.add(radialYAxis);
// add Angular X axis
const polarXAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Angular,
axisAlignment: EAxisAlignment.Top,
visibleRange: new NumberRange(0, 10),
polarLabelMode: EPolarLabelMode.Parallel,
startAngle: Math.PI / 2, // start at 12 o'clock
flippedCoordinates: true, // go clockwise
zoomExtentsToInitialRange: true,
useNativeText: true,
labelPrecision: 0,
});
sciChartSurface.xAxes.add(polarXAxis);
// Make collection to hold all the stacked mountains renderable series
const mountainCollection = new PolarStackedMountainCollection(wasmContext);
mountainCollection.separatePositiveNegativeStacks = false;
(mountainCollection.animation = new WaveAnimation({ duration: 800, zeroLine: 0 })),
MountainsDatasets.forEach(({ yValues, fillColor }) => {
const polarMountain = new PolarStackedMountainRenderableSeries(wasmContext, {
dataSeries: new XyDataSeries(wasmContext, {
xValues: [...xValues, xValues[xValues.length - 1] + 1], // add 1 more xValue to close the loop
yValues: [...yValues, yValues[0]], // close the loop by drawing to the first yValue
}),
fill: fillColor + "BB", // 75% opacity
// stroke: "white",
strokeThickness: 1,
});
mountainCollection.add(polarMountain);
});
sciChartSurface.renderableSeries.add(mountainCollection);
sciChartSurface.chartModifiers.add(
new PolarPanModifier(),
new PolarZoomExtentsModifier(),
new PolarMouseWheelZoomModifier(),
new PolarLegendModifier({
showCheckboxes: true,
backgroundColor: "#88888833",
})
);
return { sciChartSurface, wasmContext };
};
This example creates a Polar Stacked Mountain Chart in vanilla JavaScript using SciChart.js. It multiple stacked mountain series on a polar coordinate system, illustrating how to display radial data with smooth animations and interactive modifiers.
An asynchronous SciChartPolarSurface.create() call initializes the WebAssembly context and polar surface. Two axes are configured: a radial PolarNumericAxis and an angular PolarNumericAxis, each with custom ranges, label precision, and styling. A PolarStackedMountainCollection holds multiple PolarStackedMountainRenderableSeries, each constructed with an XyDataSeries that closes the loop by repeating the first data point for seamless stacking. The collection’s WaveAnimation animates series on render. Interactive behaviors—panning, mouse-wheel zoom, and zoom extents—are enabled via PolarPanModifier, PolarMouseWheelZoomModifier, and PolarZoomExtentsModifier respectively while a PolarLegendModifier provides series toggling and legend display.
The chart supports real-time updates by updating each series’ dataSeries. Custom fill opacity and stroke settings allow clear stacking visualization. The legend enables users to toggle individual mountain series on or off for focused analysis.
Use proper disposal of sciChartSurface to free WebAssembly resources when the chart is removed. Leverage CSS theming via appTheme to maintain consistent styling across your application. For deeper API details see the Polar Stacked Mountain Series documentation.




















