Skip to content

Bump chart ​

Ranks over time. Good for who overtook whom.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'bump',
  categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
  series: [
    { name: 'North', ranks: [2, 2, 3, 2, 1, 2] },
    { name: 'South', ranks: [5, 1, 1, 3, 4, 4] },
    { name: 'East', ranks: [1, 5, 2, 4, 2, 3] },
    { name: 'West', ranks: [4, 3, 5, 5, 3, 1] },
    { name: 'Centre', ranks: [3, 4, 4, 1, 5, 5] },
  ],
};

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

/** Ranks, 1 at the top. */
interface BumpSpec extends Base {
  type: 'bump';
  categories: string[];
  series: { name: string; ranks: (number | null)[]; 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