Dashboards
ts
import { createDashboard } from 'nervure/dashboard';
const board = createDashboard(host, {
link: true, // a series hidden in one chart is hidden in all
editable: true, // cards move with the mouse, or the arrow keys on their title
onMove: (ids) => localStorage.setItem('order', JSON.stringify(ids)),
items: [
{ id: 'revenue', title: 'Revenue', width: 8, height: 3, spec: revenue },
{ id: 'goal', title: 'Goal', width: 4, height: 3, spec: goal, options: { toolbar: true } },
],
});
board.update('goal', nextGoal);
board.add({ id: 'map', title: 'Map', width: 12, spec: map });
board.move('map', 0);
board.chart('revenue')?.download('png');
board.destroy();| Option | Default | Does |
|---|---|---|
columns | 12 | columns of the grid |
rowHeight, gap | 110, 16 | pixels |
stackUnder | 640 | under this width, one card by line |
theme, locale, animation, toolbar | given to every chart |
Cards are plain HTML: style .nervure-dashboard, .nervure-card and .nervure-card-title.