Speedometer chart
A needle over coloured zones. Good for a value that is good, fair or bad.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = { type: 'speedometer', value: 98, max: 200, unit: ' km/h' };
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 speedometer takes:
interface SpeedometerSpec extends Base {
type: 'speedometer';
value: number;
min?: number;
max?: number;
unit?: string;
name?: string;
zones?: { to: 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