Skip to content

River level ​

The height of a river over time, its flood levels as bands, the peak and the forecast. Good for flood warnings, rivers, reservoirs and tides.

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: 'riverlevel',
  unit: 'm',
  forecastFrom: 24,
  thresholds: [
    { name: 'Watch', value: 2.5 },
    { name: 'Flood warning', value: 3.5 },
    { name: 'Severe flood', value: 4.5 },
  ],
  data: [
    { label: 'Thu 00h', level: 1.17 },
    { label: 'Thu 03h', level: 1.2 },
    { label: 'Thu 06h', level: 1.16 },
    { label: 'Thu 09h', level: 1.16 },
    { label: 'Thu 12h', level: 1.21 },
    { label: 'Thu 15h', level: 1.21 },
    { label: 'Thu 18h', level: 1.2 },
    { label: 'Thu 21h', level: 1.22 },
    { label: 'Fri 00h', level: 1.28 },
    { label: 'Fri 03h', level: 1.38 },
    { label: 'Fri 06h', level: 1.62 },
    { label: 'Fri 09h', level: 1.76 },
    { label: 'Fri 12h', level: 2.14 },
    { label: 'Fri 15h', level: 2.5 },
    { label: 'Fri 18h', level: 3.01 },
    { label: 'Fri 21h', level: 3.47 },
    { label: 'Sat 00h', level: 3.88 },
    { label: 'Sat 03h', level: 4.22 },
    { label: 'Sat 06h', level: 4.25 },
    { label: 'Sat 09h', level: 4.19 },
    { label: 'Sat 12h', level: 3.92 },
    { label: 'Sat 15h', level: 3.49 },
    { label: 'Sat 18h', level: 3.05 },
    { label: 'Sat 21h', level: 2.52 },
    { label: 'Sun 00h', level: 2.12 },
    { label: 'Sun 03h', level: 1.81 },
    { label: 'Sun 06h', level: 1.61 },
    { label: 'Sun 09h', level: 1.38 },
    { label: 'Sun 12h', level: 1.32 },
    { label: 'Sun 15h', level: 1.23 },
    { label: 'Sun 18h', level: 1.19 },
    { label: 'Sun 21h', level: 1.23 },
  ],
};

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

/** Height of a river over time, with its flood levels. */
interface RiverLevelSpec extends Base {
  type: 'riverlevel';
  /** Colour of the main series. */
  color?: string;
  data: { label: string; level: number | null }[];
  /** Flood levels, from the lowest: a dashed line and a band above each. */
  thresholds?: { name: string; value: number; color?: string }[];
  /** m by default. */
  unit?: string;
  /** Index of the first forecast step: drawn dashed. */
  forecastFrom?: 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