Creates a React Polar Spline Line Chart using SciChart.js, using either a Cubic spline, or polar interpolation
import {
PolarMouseWheelZoomModifier,
PolarZoomExtentsModifier,
PolarPanModifier,
PolarNumericAxis,
SciChartPolarSurface,
EPolarAxisMode,
NumberRange,
EAxisAlignment,
EPolarLabelMode,
PolarLegendModifier,
PolarLineRenderableSeries,
XyDataSeries,
SplineRenderDataTransform,
WaveAnimation,
} 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,
axisAlignment: EAxisAlignment.Right,
visibleRange: new NumberRange(0, 6),
drawMinorTickLines: false,
drawMajorTickLines: false,
useNativeText: true,
drawMinorGridLines: false,
zoomExtentsToInitialRange: true,
labelPrecision: 0,
innerRadius: 0.1, // donut hole
});
sciChartSurface.yAxes.add(radialYAxis);
const polarXAxis = new PolarNumericAxis(wasmContext, {
polarAxisMode: EPolarAxisMode.Angular,
axisAlignment: EAxisAlignment.Top,
polarLabelMode: EPolarLabelMode.Parallel,
autoTicks: false,
majorDelta: 1,
useNativeText: true,
flippedCoordinates: true, // go clockwise
totalAngle: Math.PI,
labelPrecision: 0,
});
sciChartSurface.xAxes.add(polarXAxis);
const ANIMATION_DURATION = 500;
const xValues = [0, 1, 2, 3, 4, 5, 6, 7, 8];
const yValues = [3, 4, 2, 4, 5, 5, 3, 2, 4];
// 1. regular polar line
const regularPolarLine = new PolarLineRenderableSeries(wasmContext, {
dataSeries: new XyDataSeries(wasmContext, {
xValues,
yValues,
dataSeriesName: "Original Data",
}),
stroke: "#CCCCCC",
strokeThickness: 3,
});
// 2. cubic polar line
const cubicPolarLine = new PolarLineRenderableSeries(wasmContext, {
dataSeries: new XyDataSeries(wasmContext, {
xValues,
yValues,
dataSeriesName: "Cubic",
}),
stroke: appTheme.VividOrange,
strokeThickness: 5,
animation: new WaveAnimation({ duration: ANIMATION_DURATION, delay: ANIMATION_DURATION }),
});
// Add cubic bezier transform
const cubicTransform = new SplineRenderDataTransform(cubicPolarLine, wasmContext, [
cubicPolarLine.drawingProviders[0],
]);
cubicTransform.interpolationPoints = 30;
cubicPolarLine.renderDataTransform = cubicTransform;
// 3. interpolated polar line
const interpolatedPolarLine = new PolarLineRenderableSeries(wasmContext, {
dataSeries: new XyDataSeries(wasmContext, {
xValues,
yValues,
dataSeriesName: "Interpolated",
}),
interpolateLine: true, //
stroke: appTheme.VividPurple,
strokeThickness: 5,
animation: new WaveAnimation({ duration: ANIMATION_DURATION, delay: 2 * ANIMATION_DURATION }),
});
sciChartSurface.renderableSeries.add(regularPolarLine, cubicPolarLine, interpolatedPolarLine);
sciChartSurface.chartModifiers.add(
new PolarPanModifier(),
new PolarZoomExtentsModifier(),
new PolarMouseWheelZoomModifier(),
new PolarLegendModifier({
showCheckboxes: true,
})
);
return { sciChartSurface, wasmContext };
};
This React example compares the original data with cubic-spline and polar-interpolated lines, showing how each method changes the path between the same points.
SciChartReact mounts the chart through its initChart prop and the shared drawExample function. The chart uses SciChartPolarSurface; SplineRenderDataTransform smooths one series, while interpolateLine: true draws another as arcs. See the spline transform API and polar line series guide.
Staggered WaveAnimation effects reveal the lines in sequence. Pan and zoom the chart, and use the legend checkboxes to toggle series visibility.
SciChartReact manages the returned chart surface through the component lifecycle. See the SciChart React guide for integration details.




















