Athletics track race
A track seen from above with its staggered starts, the runners on their lanes and the results in the middle. Good for sprints and middle-distance races.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'trackrace',
distance: 400,
runners: [
{ name: 'Youssef Trabelsi', lane: 1, time: 45.54 },
{ name: 'Hugo Lefèvre', lane: 2, time: 45.25 },
{ name: 'Omar Jaziri', lane: 3, time: 44.76 },
{ name: 'Lucas Moreau', lane: 4, time: 45.45 },
{ name: 'Aziz Gharbi', lane: 5, time: 44.66 },
{ name: 'Théo Garnier', lane: 6, time: 44.65 },
{ name: 'Malek Ferchichi', lane: 7, time: 45.74 },
{ name: 'Nathan Roux', lane: 8, time: 45.57 },
],
};
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 trackrace takes:
/** A race on an athletics track, seen from above: staggered starts, lanes and places. */
interface TrackRaceSpec extends Base {
type: 'trackrace';
runners: { name: string; lane: number; time?: number; detail?: string; color?: string }[];
/** Metres: 200, 400 (default), 800… */
distance?: number;
/** Lanes drawn: 8 by default. */
lanes?: number;
}Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More