Skip to content

Species count ​

Rows of small animals, one for a number counted, with the change since the last survey. Good for bird counts, biodiversity surveys and reports for a wide audience.

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: 'species',
  data: [
    { name: 'Birds', kind: 'bird', count: 132, previous: 121 },
    { name: 'Butterflies', kind: 'butterfly', count: 40, previous: 69 },
    { name: 'Wild bees', kind: 'bee', count: 26, previous: 35 },
    { name: 'Amphibians', kind: 'amphibian', count: 20, previous: 21 },
    { name: 'Fish', kind: 'fish', count: 28, previous: 29 },
    { name: 'Mammals', kind: 'mammal', count: 7, previous: 7 },
  ],
};

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

/** Counts of species from a survey, as rows of small figures, with the change since the last one. */
interface SpeciesSpec extends Base {
  type: 'species';
  data: { name: string; kind: SpeciesKind; count: number; previous?: number; color?: string }[];
  /** How many each figure stands for: chosen to fit when missing. */
  each?: number;
  onItemClick?: (name: string) => void;
}

type SpeciesKind = 'bird' | 'butterfly' | 'fish' | 'mammal' | 'amphibian' | 'tree' | 'bee';

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