Wind rose
How often the wind blows from each direction, petals split by speed, with the calm in the middle. Good for airports, wind farms, sailing, building sites: where the wind comes from and how strong.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
import 'nervure/themes';
const spec = {
type: 'windrose',
classes: ['0–10 km/h', '10–20 km/h', '20–30 km/h', '30–40 km/h', 'Over 40 km/h'],
calm: 4.2,
data: [
{ direction: 'N', values: [1, 1, 0.4, 0.2, 0.1] },
{ direction: 'NNE', values: [1.3, 0.8, 0.4, 0.2, 0.1] },
{ direction: 'NE', values: [1.6, 0.7, 0.6, 0.2, 0.1] },
{ direction: 'ENE', values: [1, 0.8, 0.6, 0.2, 0.1] },
{ direction: 'E', values: [1.4, 1, 0.6, 0.2, 0.1] },
{ direction: 'ESE', values: [1.3, 1.2, 0.4, 0.2, 0.1] },
{ direction: 'SE', values: [0.9, 1.1, 0.5, 0.2, 0.1] },
{ direction: 'SSE', values: [1.5, 0.9, 0.4, 0.3, 0.1] },
{ direction: 'S', values: [2.8, 2.2, 1.1, 0.7, 0.2] },
{ direction: 'SSW', values: [3.5, 2.7, 1.3, 0.8, 0.2] },
{ direction: 'SW', values: [5.4, 5, 2.6, 1.1, 0.5] },
{ direction: 'WSW', values: [6, 4.6, 3.2, 1.7, 0.6] },
{ direction: 'W', values: [7.2, 4.1, 3.1, 1.3, 0.5] },
{ direction: 'WNW', values: [5.3, 3, 1.7, 1.1, 0.3] },
{ direction: 'NW', values: [3.4, 2.4, 1.5, 0.4, 0.2] },
{ direction: 'NNW', values: [1.5, 1, 0.7, 0.3, 0.1] },
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type windrose takes:
/** How often the wind blows from each direction, by speed class. */
interface WindRoseSpec extends Base {
type: 'windrose';
/** Names of the speed classes, from calm to strong: "0–10 km/h"… */
classes: string[];
/** One row for each direction, clockwise from north: 8 or 16 of them. `values`: % of the time, one by class. */
data: { direction: string; values: number[] }[];
/** % of the time without wind, written in the middle. */
calm?: number;
colors?: string[];
legend?: boolean | LegendOptions;
}Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More