Generation mix
What makes the power of a grid over a day, source by source, with the demand on top. Good for grid operators, energy news, and how much of the power is low-carbon.
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: 'genmix',
sources: [
{
name: 'Nuclear',
kind: 'nuclear',
data: [
34742, 35075, 35000, 35008, 35056, 34892, 35025, 35029, 35139, 35262, 34896, 35027, 34785,
34823, 35129, 35111, 34866, 34743, 35069, 35101, 35079, 35132, 35183, 34736,
],
},
{
name: 'Hydro',
kind: 'hydro',
data: [
5225, 4782, 4765, 5218, 5044, 5279, 5170, 4784, 5174, 5006, 4851, 5119, 4974, 4880, 5307,
5143, 5388, 6409, 7801, 8165, 7491, 6714, 5668, 4950,
],
},
{
name: 'Wind',
kind: 'wind',
data: [
5325, 4546, 5571, 6620, 6191, 5949, 6709, 4797, 5095, 6215, 6766, 6523, 7065, 5657, 7038,
6316, 6309, 6978, 5466, 5462, 7388, 5423, 6804, 6463,
],
},
{
name: 'Solar',
kind: 'solar',
data: [
0, 0, 0, 0, 0, 0, 0, 2893, 4339, 6858, 10946, 11713, 10724, 10000, 12674, 9911, 8600, 7482,
4773, 3115, 0, 0, 0, 0,
],
},
{
name: 'Bioenergy',
kind: 'bio',
data: [
1575, 1510, 1444, 1434, 1600, 1582, 1538, 1433, 1513, 1588, 1427, 1526, 1545, 1512, 1596,
1459, 1474, 1593, 1584, 1446, 1546, 1470, 1599, 1428,
],
},
{
name: 'Gas',
kind: 'gas',
data: [
679, 2087, 622, 500, 794, 1296, 785, 1434, 771, 500, 500, 500, 500, 500, 500, 500, 500,
500, 1887, 4403, 4702, 3929, 1446, 500,
],
},
],
demand: [
47471, 47990, 47458, 47558, 48585, 48916, 49189, 50437, 52018, 53900, 56910, 56754, 58195,
56741, 56187, 54571, 54094, 55851, 56496, 57746, 56160, 52698, 50601, 48138,
],
};
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 genmix takes:
/** What makes the power of a grid over a day, source by source, with the demand on top. */
interface GenerationMixSpec extends Base {
type: 'genmix';
/** One value every `every` minutes from `start`; `kind` gives the usual colour of the source. */
sources: { name: string; kind?: PowerSource; data: (number | null)[]; color?: string }[];
/** Total use: a line over the stack. */
demand?: (number | null)[];
every?: number;
/** "00:00" by default. */
start?: string;
/** MW by default. */
unit?: string;
legend?: boolean | LegendOptions;
}
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