Creates a React Windrose Column Chart using SciChart.js, via PolarStackedColumnRenderableSeries and a custom axis LabelProvider for cardinal directions.
This plot type is Known As: Wind Rose Chart and Wind Direction Chart or Wind Speed Chart.
drawExample.ts
index.tsx
theme.ts
1import {
2 PolarMouseWheelZoomModifier,
3 PolarZoomExtentsModifier,
4 PolarPanModifier,
5 XyDataSeries,
6 PolarNumericAxis,
7 SciChartPolarSurface,
8 EPolarAxisMode,
9 NumberRange,
10 EAxisAlignment,
11 PolarStackedColumnCollection,
12 PolarStackedColumnRenderableSeries,
13 TFormatLabelFn,
14 NumericLabelProvider,
15 EDataPointWidthMode,
16 WaveAnimation
17} from "scichart";
18import { appTheme } from "../../../theme";
19
20function getBiasedRandomWalkInBounds(min: number, max: number, count: number) {
21 // Generate the base random walk
22 const baseValues = [min];
23 for (let i = 1; i < count; i++) {
24 const next = baseValues[i - 1] + Math.random() - 0.5;
25 baseValues.push(Math.min(max, Math.max(min, next)));
26 }
27
28 // Apply an angular bias so that the random walk values become
29 return baseValues.map((val, i) => {
30 const angle = (i * 360) / count;
31 const angleRad = (angle * Math.PI) / 180;
32 // bias ranges from 0.5 to 1.5: peaks at 0°/180°, dips at 90°/270°
33 const bias = 1 + 0.3 * Math.sin(2 * angleRad);
34 return val * bias;
35 });
36}
37
38/**
39 * Custom label provider that displays compass directions at 45 degree intervals,
40 * if any label value is NOT from `[0, 45, 90, 135, 180, 225, 270, 315]` it will be a decimal.
41 */
42class CustomNESWLabelProvider extends NumericLabelProvider {
43 public LABELS = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
44
45 public get formatLabel(): TFormatLabelFn {
46 return (dataValue: number) => {
47 if (dataValue % 45 === 0) {
48 return this.LABELS[dataValue / 45];
49 }
50 return dataValue.toFixed(0) + "°";
51 };
52 }
53}
54
55const COLUMN_COUNT = 24;
56
57export const drawExample = async (rootElement: string | HTMLDivElement) => {
58 const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
59 theme: appTheme.SciChartJsTheme,
60 });
61
62 const radialYAxis = new PolarNumericAxis(wasmContext, {
63 axisAlignment: EAxisAlignment.Right,
64 polarAxisMode: EPolarAxisMode.Radial,
65 drawMinorGridLines: false,
66 drawMajorTickLines: false,
67 drawMinorTickLines: false,
68 majorGridLineStyle: {
69 color: appTheme.DarkIndigo,
70 strokeThickness: 1
71 },
72 labelStyle: {
73 color: "white"
74 },
75 startAngle: Math.PI / 2, // draw labels at 12 o'clock
76 autoTicks: false,
77 majorDelta: 1,
78 labelPrecision: 0,
79 innerRadius: 0.05 // center hole
80 });
81 sciChartSurface.yAxes.add(radialYAxis);
82
83 const polarXAxis = new PolarNumericAxis(wasmContext, {
84 polarAxisMode: EPolarAxisMode.Angular,
85 visibleRange: new NumberRange(0, 360),
86 flippedCoordinates: true, // go clockwise
87 startAngle: Math.PI / 2, // start at 12 o'clock
88 axisAlignment: EAxisAlignment.Top,
89 useNativeText: true,
90 labelProvider: new CustomNESWLabelProvider(),
91 autoTicks: false,
92 majorDelta: 15,
93 drawMinorGridLines: false,
94 zoomExtentsToInitialRange: true
95 });
96 sciChartSurface.xAxes.add(polarXAxis);
97
98 const xValues = Array.from({length: COLUMN_COUNT}, (_, i) => i * 360 / COLUMN_COUNT); // [0, 10, ..., 350],
99 const yValues = [
100 getBiasedRandomWalkInBounds(1, 2, COLUMN_COUNT),
101 getBiasedRandomWalkInBounds(0.3, 1, COLUMN_COUNT),
102 getBiasedRandomWalkInBounds(0.3, 1, COLUMN_COUNT),
103 getBiasedRandomWalkInBounds(0.5, 2, COLUMN_COUNT),
104 getBiasedRandomWalkInBounds(0.2, 0.4, COLUMN_COUNT),
105 ];
106
107 const COLORS = [
108 appTheme.DarkIndigo,
109 appTheme.Indigo,
110 appTheme.VividGreen,
111 appTheme.VividOrange,
112 appTheme.VividPink,
113 ]
114
115 const collection = new PolarStackedColumnCollection(wasmContext, {
116 isOneHundredPercent: false,
117 });
118 collection.animation = new WaveAnimation({ duration: 1000, fadeEffect: true });
119
120 for(let i = 0; i < yValues.length; i++) {
121 const dataSeries = new XyDataSeries(wasmContext, { xValues, yValues: yValues[i] });
122 const polarColumn = new PolarStackedColumnRenderableSeries(wasmContext, {
123 dataSeries,
124 fill: COLORS[i],
125 stroke: appTheme.DarkIndigo,
126 strokeThickness: 2,
127 dataPointWidthMode: EDataPointWidthMode.Range,
128 });
129 collection.add(polarColumn);
130 }
131 sciChartSurface.renderableSeries.add(collection);
132
133 sciChartSurface.chartModifiers.add(
134 new PolarPanModifier(),
135 new PolarZoomExtentsModifier(),
136 new PolarMouseWheelZoomModifier()
137 );
138
139 return { sciChartSurface, wasmContext };
140};This React example showcases a Polar Windrose Column Chart using SciChart.js, wrapped in a reusable component. The chart displays directional data with stacked columns in a polar layout.
The implementation uses SciChart React component with an initChart prop pointing to the drawExample function. The polar surface configuration matches the JavaScript version, using EPolarAxisMode for axis setup.
The chart features compass-direction labels via custom label provider and stacked columns with distinct colors. The PolarMouseWheelZoomModifier enables intuitive zooming.
The example demonstrates React best practices by encapsulating chart logic in a separate function and using CSS modules for styling. For performance, consider memoizing the initChart callback in production apps.

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

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.

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.

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.

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

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

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

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.

This React Stacked Radial Bar Chart example shows Olympic medal data by country. Try the demo for yourself with async initialization and theme application.

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

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

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.

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.

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.

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

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

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

No description available for this example yet

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.

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.

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