Skip to content

Race circuit ​

Runners that move along a track, with their gaps. Good for motor races, running, cycling, sales contests.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'circuit',
  track: 'oval',
  total: 12,
  runners: [
    { name: 'Lina', laps: 6.74 },
    { name: 'Sami', laps: 6.31 },
    { name: 'Nour', laps: 6.91 },
    { name: 'Adam', laps: 6.23 },
    { name: 'Ines', laps: 6.22 },
    { name: 'Omar', laps: 7.16 },
  ],
};

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

/** Runners on a circuit. */
interface CircuitSpec extends Base {
  type: 'circuit';
  runners: Runner[];
  track?: 'oval' | 'city' | 'mountain';
  total?: number;
}

interface Runner {
  name: 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