Creates a JavaScript Polar Label Modes Chart using SciChart.js, which demonstrates the different label modes we support for Polar Axes.
import {
SciChartPolarSurface,
PolarMouseWheelZoomModifier,
PolarZoomExtentsModifier,
PolarPanModifier,
XyDataSeries,
PolarLineRenderableSeries,
EllipsePointMarker,
PolarNumericAxis,
EPolarAxisMode,
NumberRange,
EPolarLabelMode,
} from "scichart";
import { appTheme } from "./appTheme";
export const drawExample = async (rootElement: string | HTMLDivElement) => {
const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
theme: appTheme.SciChartJsTheme,
});
const radialYAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Radial,
drawMinorGridLines: false,
drawMajorTickLines: false,
drawMinorTickLines: false,
useNativeText: true,
drawLabels: true,
innerRadius: 0,
labelPrecision: 0,
});
sciChartSurface.yAxes.add(radialYAxis);
// Only Angular axes support `polarLabelMode`
const angularXAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Angular,
polarLabelMode: EPolarLabelMode.Horizontal, // this will change based on user input
visibleRange: new NumberRange(0, 100),
useNativeText: true,
drawMinorGridLines: false,
drawMajorTickLines: false,
drawMinorTickLines: false,
zoomExtentsToInitialRange: true,
labelStyle: {
fontSize: 16,
},
});
sciChartSurface.xAxes.add(angularXAxis);
// Add a series to better visualize the chart
const polarlineSeries = new PolarLineRenderableSeries(wasmContext, {
dataSeries: new XyDataSeries(wasmContext, {
xValues: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90],
yValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
}),
pointMarker: new EllipsePointMarker(wasmContext),
stroke: appTheme.VividOrange,
strokeThickness: 3,
});
sciChartSurface.renderableSeries.add(polarlineSeries);
sciChartSurface.chartModifiers.add(
new PolarPanModifier(),
new PolarZoomExtentsModifier(),
new PolarMouseWheelZoomModifier({ growFactor: 0.0002 })
);
// sets new polarLabelMode
function changePolarLabelMode(newMode: EPolarLabelMode) {
angularXAxis.polarLabelMode = newMode;
}
return {
sciChartSurface,
wasmContext,
controls: {
changePolarLabelMode,
toggleIsInnerAxis: (isInnerAxis: boolean) => {
angularXAxis.isInnerAxis = isInnerAxis;
radialYAxis.isInnerAxis = isInnerAxis;
},
},
};
};
This example shows how EPolarLabelMode changes the angular labels on a polar chart. Switch between horizontal, perpendicular, and parallel labels, and move the axes inside or outside the plot.
The chart uses SciChartPolarSurface with radial and angular PolarNumericAxis instances. The angular axis sets polarLabelMode; the radial axis provides context for the plotted PolarLineRenderableSeries. See the polar axis styling documentation for the available label modes.
Use the label-mode control to call changePolarLabelMode and update the angular axis. Toggle the inner-axis setting to change isInnerAxis on both axes. Drag to pan, scroll to zoom, or use the chart modifiers: PolarPanModifier, PolarZoomExtentsModifier, and PolarMouseWheelZoomModifier.




















