React Stacked Radial Column Chart | Stacked Radial Bar Chart

Creates a React Stacked Radial Column Chart representing Olympic medals per country, using SciChart.js

Fullscreen

Edit

 Edit

Docs

drawExample.ts

index.tsx

theme.ts

Copy to clipboard
Minimise
Fullscreen
1import {
2    PolarMouseWheelZoomModifier,
3    PolarZoomExtentsModifier,
4    PolarPanModifier,
5    XyDataSeries,
6    PolarNumericAxis,
7    SciChartPolarSurface,
8    EPolarAxisMode, 
9    NumberRange, 
10    EAxisAlignment, 
11    EXyDirection,
12    PolarCategoryAxis,
13    TextLabelProvider,
14    PolarStackedColumnCollection,
15    PolarStackedColumnRenderableSeries,
16    EPolarLabelMode,
17    PolarLegendModifier,
18    ELegendPlacement,
19    GradientParams,
20    Point,
21    WaveAnimation
22} from "scichart";
23import { appTheme } from "../../../theme";
24
25const DATA: Record<string, number[]> = {
26    "Norway": [122, 125, 111],
27    "USA": [105, 110, 88],
28    "Germany": [92, 88, 60],
29    "Canada": [73, 64, 62],
30    "Austria": [64, 81, 87],
31    "Sweden": [57, 46, 55],
32    "Switzerland": [56, 45, 52],
33    "Russia": [47, 38, 35],
34    "Netherlands": [45, 44, 41],
35    "Finland": [43, 55, 59]
36}
37const COUNTRIES = Object.keys(DATA);
38
39const MEDALS = [
40    {
41        type: "Gold",
42        color: appTheme.MutedOrange,
43    },
44    {
45        type: "Silver",
46        color: appTheme.PaleBlue,
47    },
48    {
49        type: "Bronze",
50        color: appTheme.MutedRed,
51    }
52];
53
54export const drawExample = async (rootElement: string | HTMLDivElement) => {
55    const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
56        theme: appTheme.SciChartJsTheme,
57        title: "Winter Olympic medals per country",
58        titleStyle: {
59            fontSize: 24,
60        }
61    });
62
63    // Create Polar, Radial axes
64    const xAxis = new PolarCategoryAxis(wasmContext, {
65        polarAxisMode: EPolarAxisMode.Radial,
66        axisAlignment: EAxisAlignment.Left,
67        visibleRange: new NumberRange(-1, 9),
68        zoomExtentsToInitialRange: true,
69
70        autoTicks: false,
71        majorDelta: 1,
72
73        labelStyle: {
74            color: "white",
75        },
76        useNativeText: true,
77        flippedCoordinates: true, // Norway will be outermost, Finland innermost
78        innerRadius: 0.1, // donut hole
79        drawMinorTickLines: false,
80        drawMinorGridLines: false,
81        drawMajorTickLines: false,
82        startAngle: Math.PI,
83    });
84    xAxis.labelProvider = new TextLabelProvider({
85        labels: Object.keys(DATA),
86    });
87    sciChartSurface.xAxes.add(xAxis);
88
89    const yAxis = new PolarNumericAxis(wasmContext, {
90        polarAxisMode: EPolarAxisMode.Angular,
91        axisAlignment: EAxisAlignment.Top,
92        polarLabelMode: EPolarLabelMode.Parallel,
93        drawMinorTickLines: false,
94        drawMinorGridLines: false,
95        drawMajorTickLines: false,
96        flippedCoordinates: true,
97        labelPrecision: 0,
98        useNativeText: true,
99        autoTicks: false,
100        majorDelta: 25,
101        startAngle: Math.PI,
102        totalAngle: Math.PI * 3 / 2 // 270 degrees, 3/4 of the circle
103    });
104    sciChartSurface.yAxes.add(yAxis);
105
106    // SERIES
107    const collection = new PolarStackedColumnCollection(wasmContext);
108    collection.animation = new WaveAnimation({ duration: 1000, fadeEffect: true });
109    
110    const xValues = Array.from({ length: COUNTRIES.length }, (_, i) => i);
111    for(let i = 0; i < 3; i++){
112        const polarColumn = new PolarStackedColumnRenderableSeries(wasmContext, {
113            dataSeries: new XyDataSeries(wasmContext, {
114                xValues,
115                yValues: COUNTRIES.map(country => DATA[country][i]),
116                dataSeriesName: MEDALS[i].type,
117            }),
118            stroke: "white",
119            strokeThickness: 1.5,
120            fill: MEDALS[i].color, // keep the "fill" although overriden by "fillLinearGradient" for legend marker color
121            fillLinearGradient: new GradientParams(new Point(0, 0), new Point(0, 1), [
122                { color: MEDALS[i].color, offset: 0.5 },
123                { color: "#222222", offset: 1 },
124            ]),
125        });
126        collection.add(polarColumn);
127    }
128
129    sciChartSurface.renderableSeries.add(collection);
130
131    // MODIFIERS
132    sciChartSurface.chartModifiers.add(
133        new PolarPanModifier({
134            xyDirection: EXyDirection.XyDirection,
135            zoomSize: true,
136            growFactor: 1
137        }),
138        new PolarZoomExtentsModifier(),
139        new PolarMouseWheelZoomModifier(),
140        new PolarLegendModifier({
141            placement: ELegendPlacement.TopLeft,
142            backgroundColor: "rgba(0,0,0,0.3)",
143            showCheckboxes: true,
144        })
145    );
146
147    return { sciChartSurface, wasmContext };
148};

Polar Stacked Radial Column Chart - React

Overview

This React example showcases a Polar Stacked Radial Column Chart using SciChart's SciChart React component. It visualizes Olympic medal data with stacked radial columns, demonstrating React integration with SciChart's polar charts.

Technical Implementation

The chart is initialized via the initChart prop passed to <SciChartReact/>, creating a SciChartPolarSurface with radial columns. The implementation uses React's component structure while leveraging SciChart's WebAssembly core for high performance.

Features and Capabilities

The chart features medal data grouped by country with PolarStackedColumnRenderableSeries for each medal type. Interactive elements include PolarMouseWheelZoomModifier and a configurable legend.

Integration and Best Practices

The example demonstrates proper React integration patterns using SciChart's dedicated React component. The async initialization and theme application follow React best practices for data visualization components.

react Chart Examples & Demos

See Also: Polar Charts (21 Demos)

React Polar Line Chart | React Charts | SciChart.js Demo

React Polar Line Chart

Explore the React Polar Line Chart example to create data labels, line interpolation, gradient palette stroke and startup animations. Try the SciChart Demo.

React Polar Spline Line Chart | React Charts | SciChart.js

React Polar Spline Line Chart

Try the React Polar Spline Line Chart example to see SciChart's GPU-accelerated rendering in action. Choose a cubic spline or polar interpolation. View demo.

React Multi-Cycle Polar Line | React Charts | SciChart.js

React Multi Cycle-Polar Line Example

Create a React Multi-Cycle Polar Chart to plot data over multiple cycles and visualize patterns over time. This example shows surface temperature by month.

React Polar Column Chart | React Polar Bar Chart | SciChart

React Polar Column | React Polar Bar

Try the React Polar Bar Chart example to render bars in a polar layout with gradient fills and animations. Use SciChart for seamless integration with React.

React Polar Column Category Chart | SciChart.js Demo

React Polar Column Category Chart

Create a React Polar Colum Category chart visualizing UK consumer price changes. Try the demo with a custom positive/negative threshold fill and stroke.

React Polar Range Column Chart | React Charts | SciChart.js

React Polar Range Column Chart

Create a React Polar Range Column Chart with SciChart. This example displays monthly minimum and maximum temperatures within a Polar layout. Try the demo.

React Windrose Plot | React Polar Stacked Radial Column Chart

React Windrose Plot | React Polar Stacked Radial Column Chart

View the React Windrose Chart example to display directional data with stacked columns in a polar layout. Try the polar chart demo with customizable labels.

React Polar Sunburst Chart | React Charts | SciChart.js

React Polar Sunburst Chart

See the React Sunburst Chart example with multiple levels, smooth animation transitions and dynamically updating segment colors. Try the SciChart demo.

React Polar Radial Column Chart | React Charts | SciChart.js

React Polar Radial Column Chart

View the React Radial Column Chart example to see the difference that SciChart has to offer. Switch radial and angular axes and add interactive modifiers.

React Polar Area Chart | Polar Mountain Chart | SciChart

React Polar Area Chart | Polar Mountain Chart

The React Polar Area Chart example, also known as Nightingale Rose Chart, renders an area series with polar coordinates with interactive legend controls.

React Polar Stacked Radial Mountain Chart | SciChart.js

React Polar Stacked Radial Mountain Chart

Try the React Stacked Radial Mountain Chart example to show multiple datasets on a polar layout with a stacked mountain series and animated transitions.

React Polar Band | Polar Error Bands Chart | SciChart.js

React Polar Band | Polar Error Bands Chart

Create a React Polar Chart with regular and interpolated error bands. Enhance a standard chart with shaded areas to show upper and lower data boundaries.

React Polar Scatter Chart | React Charts | SciChart.js Demo

React Polar Scatter Chart

Build a React Polar Scatter Chart with this example to render multiple scatter series on radial and angular axes. Try the flexible SciChart demo today.

React Polar Radar Chart | Spider Radar Chart | SciChart

React Polar Radar Chart

View the React Polar Radar Chart example. Also known as the Spider Radar Chart, view the scalability and stability that SciChart has to offer. Try demo.

React Polar Gauge Chart | React Circular Gauge | SciChart

React Gauge Charts

Create React Gauge Charts, including a React Circular Gauge Dashboard, with React-friendly initialization and responsive design. Give the SciChart demo a go.

React Arc Gauge & FIFO Scrolling Charts Dashboard | SciChart

React Arc Gauge & FIFO Scrolling Charts Dashboard Example

View React Arc Gauge Charts alongside FIFO Scrolling Charts, all on the same dashboard with real-time, high-performance data rendering. Try the demo.

React Polar Uniform Heatmap Chart | SciChart.js Demo

React Polar Uniform Heatmap Chart

Try SciChart's React Polar Heatmap example to combine a polar heatmap with a legend component. Supports responsive design and chart and legend separation.

React Polar Heatmap | B-Mode Image Ultrasound | Medical Heatmap

React Polar Heatmap | B-Mode Image Ultrasound | Medical Heatmap

No description available for this example yet

React Polar Partial Arc | React Charts | SciChart.js Demo

React Polar Partial Arc

Create a React Polar Partial Arc that bends from a full Polar Circle to a Cartesian-like arc. Try the demo to display an arc segment with Polar coordinates.

React Polar Axis Label Modes | React Charts | SciChart.js

React Polar Axis Label Modes

Create a React Polar Axis Label with SciChart. This demo shows the various label modes for Polar Axes – all optimised for pan, zoom, and mouse wheel.

React Polar Map Example | React Charts | SciChart.js Demo

React Polar Map Example

View the React Polar Map Example using the SciChartReact component. Display geographic data as color-coded triangles on a polar coordinate system. Try demo.

SciChart Ltd, 16 Beaufort Court, Admirals Way, Docklands, London, E14 9XL.