Skip to content

Tunnel chart ​

Steps seen one inside the other. Good for a funnel in little height.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'tunnel',
  shape: 'square',
  data: [
    { name: 'Visitors', value: 5938 },
    { name: 'Sign-ups', value: 2494 },
    { name: 'Trials', value: 1397 },
    { name: 'Customers', value: 559 },
    { name: 'Subscribers', value: 224 },
  ],
};

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

/** Steps seen from inside, the largest in front. */
interface TunnelSpec extends Base {
  type: 'tunnel';
  data: Item[];
  shape?: 'round' | 'square';
}

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