Power plant board
Each unit as a tile: its state, what it gives and its capacity, and the totals. Good for control rooms and dashboards of producers.
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: 'plantboard',
data: [
{ name: 'North 1', site: 'North', kind: 'nuclear', capacity: 1300, output: 598, state: 'reduced' },
{ name: 'North 2', site: 'North', kind: 'nuclear', capacity: 1300, output: 1196, state: 'running' },
{ name: 'River 1', site: 'River', kind: 'nuclear', capacity: 900, output: 783, state: 'running' },
{ name: 'Lake dam', site: 'Lake', kind: 'hydro', capacity: 600, output: 0, state: 'maintenance' },
{ name: 'Coast CCGT', site: 'Coast', kind: 'gas', capacity: 450, output: 171, state: 'reduced' },
{ name: 'Ridge wind', site: 'Ridge', kind: 'wind', capacity: 300, output: 264, state: 'running' },
{ name: 'Plain solar', site: 'Plain', kind: 'solar', capacity: 250, output: 248, state: 'running' },
{ name: 'Harbour CCGT', site: 'Harbour', kind: 'gas', capacity: 420, output: 395, state: 'running' },
],
};
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 plantboard takes:
/** The units of power plants as tiles: their state and how much of their capacity they give. */
interface PlantBoardSpec extends Base {
type: 'plantboard';
data: { name: string; site?: string; kind?: PowerSource; capacity: number; output: number; state: UnitState }[];
/** MW by default. */
unit?: string;
onItemClick?: (name: string) => void;
}
type PowerSource =
'nuclear' | 'hydro' | 'wind' | 'solar' | 'gas' | 'coal' | 'oil' | 'bio' | 'imports' | 'storage' | 'other';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