Car dashboard
Speed and engine speed on two dials, the gear, fuel or battery, temperature and range. Good for telematics, driving simulators and fleet screens.
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: 'carcluster', speed: 96, rpm: 2730, gear: '3', fuel: 51, temperature: 87, range: 177, odometer: 93294 };
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 carcluster takes:
/** A car dashboard: speed and engine speed on two dials, fuel or battery, temperature and gear. */
interface CarClusterSpec extends Base {
type: 'carcluster';
speed: number;
/** End of the speed dial: 220 by default. */
maxSpeed?: number;
/** `km/h` by default. */
speedUnit?: string;
/** Engine speed, in revolutions per minute; an electric car shows `power` instead. */
rpm?: number;
/** End of the rev counter: 7000 by default; the red zone starts at `redline` (85 % of it by default). */
maxRpm?: number;
redline?: number;
/** Power drawn, in kW, from -50 (regeneration) to `maxPower`, for an electric car. */
power?: number;
maxPower?: number;
/** Fuel or battery left, from 0 to 100. */
fuel?: number;
electric?: boolean;
/** Coolant or battery temperature, in °C. */
temperature?: number;
gear?: string;
/** Distance left, in the unit of the speed. */
range?: number;
odometer?: number;
}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