Degree days
Heating degree days against the normal, with the gas used each month. Good for energy bills and building management: was it colder, or did we use more?
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: 'degreedays',
base: 18,
data: [
{ label: 'Jan', degreeDays: 414, normal: 410, use: 12770 },
{ label: 'Feb', degreeDays: 305, normal: 350, use: 9805 },
{ label: 'Mar', degreeDays: 255, normal: 300, use: 7745 },
{ label: 'Apr', degreeDays: 198, normal: 190, use: 6488 },
{ label: 'May', degreeDays: 79, normal: 90, use: 2641 },
{ label: 'Jun', degreeDays: 18, normal: 20, use: 872 },
{ label: 'Jul', degreeDays: 0, normal: 0, use: 350 },
{ label: 'Aug', degreeDays: 0, normal: 0, use: 350 },
{ label: 'Sep', degreeDays: 38, normal: 40, use: 1452 },
{ label: 'Oct', degreeDays: 144, normal: 160, use: 4958 },
{ label: 'Nov', degreeDays: 235, normal: 290, use: 7635 },
{ label: 'Dec', degreeDays: 391, normal: 380, use: 12471 },
],
};
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 degreedays takes:
/** Heating degree days against the normal, and the gas used with them. */
interface DegreeDaysSpec extends Base {
type: 'degreedays';
/** Colour of the main series. */
color?: string;
data: { label: string; degreeDays: number; normal?: number; use?: number | null }[];
/** kWh by default. */
unit?: string;
/** Base temperature, written in the legend: 18 °C by default. */
base?: number;
}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