Bullet chart
A value, its target and bands of quality. Good for goals, in the room of a line of text.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'bullet',
data: [
{ name: 'Revenue', value: 68, target: 72, ranges: [40, 70, 100] },
{ name: 'Margin', value: 49, target: 75, ranges: [40, 70, 100] },
{ name: 'Orders', value: 47, target: 64, ranges: [40, 70, 100] },
{ name: 'New clients', value: 74, target: 77, ranges: [40, 70, 100] },
],
};
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 bullet takes:
interface BulletSpec extends Base {
type: 'bullet';
data: {
name: string;
value: number;
target?: number;
/** Ends of the bands, from the worst to the best. */ ranges?: 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