Progress bars
How much of each goal is done. Good for tasks, quotas and levels.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'progress',
unit: ' %',
data: [
{ name: 'Design', value: 59 },
{ name: 'Build', value: 48 },
{ name: 'Test', value: 29 },
{ name: 'Launch', value: 56 },
],
};
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 progress takes:
interface ProgressSpec extends Base {
type: 'progress';
data: {
name: string;
value: number;
max?: number;
color?: string;
/** Second line, under the bar. */
detail?: string;
/** Mark on the bar: what was expected by now, a threshold. */
target?: number;
}[];
unit?: 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