Skip to content

Electricity meter ​

The index of a meter on rolling digits, what was used since a reading, and its registers. Good for energy apps and bills: what a home or a site used.

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: 'powermeter',
  value: 51019.3,
  previous: 50724.3,
  since: 'since 1 Nov',
  power: 2.2,
  registers: [{ name: 'Peak hours', value: 31632 }, { name: 'Off-peak hours', value: 19387 }],
};

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

/** The index of an electricity meter on rolling digits, and what was used since a reading. */
interface PowerMeterSpec extends Base {
  type: 'powermeter';
  /** Colour of the main series. */
  color?: string;
  /** The index, in kWh. */
  value: number;
  /** An earlier index: the use since then. */
  previous?: number;
  /** "since 1 May"… */
  since?: string;
  /** Digits of the counter: 6 by default. */
  digits?: number;
  /** Registers of the tariffs: peak and off-peak… */
  registers?: { name: string; value: number }[];
  /** Power drawn now, in kW: the disc turns faster. */
  power?: number;
  /** kWh by default. */
  unit?: string;
}

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