React Polar Range Column Chart

Creates a React Polar Range Column Chart using SciChart.js, with y/y1 values for each column, using the XyyDataSeries

src/drawExample.ts
import {
    PolarMouseWheelZoomModifier,
    PolarZoomExtentsModifier,
    PolarPanModifier,
    PolarNumericAxis,
    SciChartPolarSurface,
    EPolarAxisMode,
    NumberRange,
    PolarCategoryAxis,
    PolarColumnRenderableSeries,
    XyyDataSeries,
    SweepAnimation,
} from "scichart";
import { appTheme } from "./appTheme";

export const MONTHS_SHORT = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
export const TEMPERATURE_DATA = {
    min: [
        11.81948, 12.034697, 12.778375, 13.789007, 14.624746, 15.316486, 15.89393, 15.517554, 14.725496, 13.799661,
        12.776523, 12.119616,
    ],
    max: [
        12.493054, 12.817261, 14.034957, 14.891214, 15.676935, 16.244125, 16.889472, 16.512617, 15.804098, 14.787963,
        13.775281, 13.000732,
    ],
};

export const drawExample = async (rootElement: string | HTMLDivElement) => {
    const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
        theme: appTheme.SciChartJsTheme,
        title: "Min and Max surface temperature of each month of 2024",
        titleStyle: {
            fontSize: 24,
        },
    });

    const radialYAxis = new PolarNumericAxis(wasmContext, {
        polarAxisMode: EPolarAxisMode.Radial,
        drawLabels: true,
        labelPrecision: 0,
        // labelStyle: {
        //     color: "white",
        // },
        labelPostfix: "°C",
        autoTicks: false,
        majorDelta: 1,
        drawMinorGridLines: false,
        visibleRange: new NumberRange(11, 17), // min and max temperatures
        zoomExtentsToInitialRange: true,
        innerRadius: 0.05, // donut hole
        startAngle: Math.PI / 2, // start only after 12 o'clock
    });
    sciChartSurface.yAxes.add(radialYAxis);

    const polarXAxis = new PolarCategoryAxis(wasmContext, {
        polarAxisMode: EPolarAxisMode.Angular,
        labels: MONTHS_SHORT,
        autoTicks: false,
        majorDelta: 1, // one tick per month

        // replace minors with majors by not drawing majors and setting this:
        minorsPerMajor: 2,

        drawMajorGridLines: false,
        drawMinorGridLines: true,
        drawMajorTickLines: false,
        drawMinorTickLines: false,

        flippedCoordinates: true, // grow clockwise
        startAngle: Math.PI / 2 - Math.PI / 12,
        visibleRange: new NumberRange(0, 12), // 12 months
        zoomExtentsToInitialRange: true,
    });
    sciChartSurface.xAxes.add(polarXAxis);

    // Add series
    const xValues = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
    const columns = new PolarColumnRenderableSeries(wasmContext, {
        dataSeries: new XyyDataSeries(wasmContext, {
            xValues,
            yValues: TEMPERATURE_DATA.min,
            y1Values: TEMPERATURE_DATA.max,
        }),
        dataPointWidth: 1,
        fill: appTheme.VividSkyBlue + "44",
        stroke: appTheme.VividSkyBlue,
        animation: new SweepAnimation({ duration: 800 }),
    });
    sciChartSurface.renderableSeries.add(columns);

    // Add modifiers
    sciChartSurface.chartModifiers.add(
        new PolarPanModifier(),
        new PolarZoomExtentsModifier(),
        new PolarMouseWheelZoomModifier()
    );

    return { sciChartSurface, wasmContext };
};

Polar Range Column Chart - React

Overview

This React example showcases a Polar Range Column Chart using SciChart.js and the SciChartReact component. It displays monthly minimum and maximum temperatures within a circular polar layout.

Technical Implementation

The `` wrapper invokes drawExample, which calls SciChartPolarSurface.create() to configure a radial PolarNumericAxis (API reference) and an angular PolarCategoryAxis. Data is bound to a PolarColumnRenderableSeries via XyyDataSeries, animated with SweepAnimation. Interactive modifiers (Pan, ZoomExtents, MouseWheelZoom) are added to enhance UX.

Features and Capabilities

Supports dynamic data updates by manipulating the XyyDataSeries at runtime. Custom styling of columns is achieved through fill and stroke properties, and innerRadius creates a donut effect.

Integration and Best Practices

Leverage React’s component lifecycle to manage chart creation and disposal—initialize in useEffect and call sciChartSurface.delete() on unmount. Batch data updates to reduce re-renders and ensure WebAssembly contexts are reused.