Polar chart
A line around a dial. Good for hours of the day, directions of the wind.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'polar',
categories: [
'0 h', '1 h', '2 h', '3 h', '4 h', '5 h', '6 h', '7 h', '8 h', '9 h', '10 h', '11 h',
'12 h', '13 h', '14 h', '15 h', '16 h', '17 h', '18 h', '19 h', '20 h', '21 h', '22 h',
'23 h',
],
series: [
{
name: 'Week',
data: [
31.1, 29.7, 23.8, 24.2, 17.4, 10.5, 13.5, 14.9, 9.9, 5.4, 4, 4, 13.8, 5.2, 8.4, 4, 4, 4, 4,
9.4, 4, 4, 6.5, 6.1,
],
},
{
name: 'Week-end',
data: [
37.4, 31.8, 30.2, 31.6, 39.9, 34.9, 36.8, 34.5, 26.4, 32.2, 28.6, 28.3, 38.2, 46.3, 43.9,
37.3, 42.9, 41.3, 41.4, 42.6, 39.9, 50.7, 48.4, 43.7,
],
},
],
};
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 polar takes:
/** Values around a circle, such as the hours of a day. */
interface PolarSpec extends Base {
type: 'polar';
categories: string[];
series: { name: string; data: number[]; color?: string }[];
}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