Load curve
Power used over a day, the peak hours shaded, and the price on a second scale. Good for grids, factories and buildings: when power is used, and what it costs then.
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: 'loadcurve',
every: 30,
data: [
25652, 25476, 25730, 25450, 25457, 25874, 25843, 25636, 25735, 25832, 26009, 26861, 26466,
27399, 27494, 28550, 29275, 30284, 31770, 32358, 33844, 35056, 35885, 36929, 36875, 37197,
37155, 36977, 35734, 35121, 34008, 32928, 32926, 32495, 33227, 34915, 36598, 37984, 39107,
39889, 38709, 36850, 34378, 31660, 29997, 27845, 26683, 26081,
],
price: [
51, 54, 51, 55, 59, 58, 57, 60, 52, 53, 59, 63, 61, 65, 60, 67, 66, 68, 75, 70, 73, 84, 78,
85, 84, 88, 79, 77, 83, 79, 82, 76, 69, 75, 74, 75, 83, 83, 84, 94, 85, 76, 73, 75, 70, 61,
62, 58,
],
peak: [['06:00', '22:00']],
};
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 loadcurve takes:
/** Power used over a day, with peak and off-peak hours and the price. */
interface LoadCurveSpec extends Base {
type: 'loadcurve';
/** Colour of the main series. */
color?: string;
/** One value every `every` minutes from midnight (60 by default). */
data: (number | null)[];
every?: number;
/** MW by default. */
unit?: string;
/** Price over the same steps, on a second scale. */
price?: (number | null)[];
/** €/MWh by default. */
priceUnit?: string;
/** Peak hours: ["07:00", "23:00"] pairs; the rest of the day is off-peak. */
peak?: [string, 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