Skip to content

Energy label ​

Classes A to G, where a home stands on them, and its greenhouse gas beside. Good for real estate listings, building audits and renovation plans.

The smallest code that works. change the code, then press Run

In your framework

import { Chart } from 'nervure/react';

const spec = { type: 'energy', value: 194, gas: 26 };

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 energy takes:

/** Energy label: classes A to G and the place of a home on them, with its greenhouse gas beside. */
interface EnergySpec extends Base {
  type: 'energy';
  /** Energy used, in kWh per m² and per year. */
  value: number;
  /** Greenhouse gas, in kg CO₂ per m² and per year: a second scale, and the class is the worse of the two. */
  gas?: number;
  /** Upper bounds of classes A to F: the French ones by default (70, 110, 180, 250, 330, 420). */
  bounds?: number[];
  /** 6, 11, 30, 50, 70, 100 by default. */
  gasBounds?: number[];
}

Style it

  • Colours: theme.palette, chart.setColor(name, colour), or --nervure-palette in your CSS. More
  • Marks: [data-series="name"], parts: [data-part="axes"], legend, series. What you change is kept in exports.
  • Movement: animation: false draws at once. More
  • Files: chart.download('png'), svg, csv. More

Close to it