Skip to content

Error bars ​

A value and its interval. Good for measures with their uncertainty.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'errorbar',
  data: [
    { name: 'Kairouan', value: 40, low: 34, high: 55 },
    { name: 'Gabes', value: 31, low: 20, high: 35 },
    { name: 'Sousse', value: 51, low: 44, high: 58 },
    { name: 'Mahdia', value: 66, low: 62, high: 75 },
    { name: 'Djerba', value: 59, low: 50, high: 73 },
    { name: 'Sfax', value: 39, low: 30, high: 49 },
  ],
};

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

interface ErrorBarSpec extends Base {
  type: 'errorbar';
  data: { name: string; value: number; low: number; high: number; color?: 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