Angular Windrose Plot | Angular Polar Stacked Radial Column Chart

Creates a Angular 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.

Fullscreen

Edit

 Edit

Docs

drawExample.ts

angular.ts

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    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};

Polar Windrose Column Chart - Angular

Overview

This Angular standalone component demonstrates a Polar Windrose Column Chart using SciChart.js. The chart visualizes multi-series directional data in a polar coordinate system.

Technical Implementation

The component uses ScichartAngularComponent with the same drawExample function as other frameworks. The angular-specific setup includes proper TypeScript typing and standalone component architecture.

Features and Capabilities

The chart maintains all features from the JavaScript version including PolarStackedColumnCollection and custom label formatting. The NumberRange ensures proper axis scaling.

Integration and Best Practices

The example follows Angular best practices by using standalone components and proper TypeScript types. For production use, consider implementing OnDestroy for cleanup.

angular Chart Examples & Demos

See Also: Polar Charts (21 Demos)

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

Angular 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.

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

Angular Polar Spline Line Chart

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

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

Angular Multi Cycle-Polar Line Example

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

Angular Polar Column Chart | Polar Bar Chart | SciChart

Angular Polar Column Chart | Angular Polar Bar

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

Angular Polar Column Category Chart | SciChart.js Demo

Angular Polar Column Category Chart

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

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

Angular Polar Range Column Chart

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

Angular Polar Sunburst Chart | Angular Charts | SciChart.js

Angular Polar Sunburst Chart

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

Angular Polar Radial Column Chart | SciChart.js Demo

Angular Polar Radial Column Chart

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

Angular Stacked Radial Column Chart | Stacked Radial Bar Chart

Angular Stacked Radial Column Chart | Stacked Radial Bar Chart

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

Angular Polar Area Chart | Polar Mountain Chart | SciChart

Angular Polar Area Chart | Polar Mountain Chart

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

Angular Polar Stacked Radial Mountain Chart | SciChart.js

Angular Polar Stacked Radial Mountain Chart

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

Angular Polar Band | Polar Error Bands Chart | SciChart

Angular Polar Band | Polar Error Bands Chart

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

Angular Polar Scatter Chart | Angular Charts | SciChart.js

Angular Polar Scatter Chart

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

Angular Polar Radar Chart | Spider Radar Chart | SciChart

Angular Polar Radar Chart

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

Angular Polar Gauge Chart | Angular Circular Gauge | SciChart

Angular Gauge Charts

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

Angular Arc Gauge & FIFO Scrolling Charts Dashboard

Angular Arc Gauge & FIFO Scrolling Charts Dashboard Example

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

Angular Polar Uniform Heatmap Chart | SciChart.js Demo

Angular Polar Uniform Heatmap Chart

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

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

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

No description available for this example yet

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

Angular Polar Partial Arc

Create an Angular 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.

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

Angular Polar Axis Label Modes

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

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

Angular 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.