Swimming race
One lane for each swimmer, the time of each length, the final time, places and gaps. Good for swimming results, heats and finals.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'swimrace',
pool: 50,
swimmers: [
{ name: 'Ines Ayari', lane: 1, splits: [26.82, 55.69, 84.79, 113.66] },
{ name: 'Léa Martin', lane: 2, splits: [26.34, 54.88, 84.51, 113.45] },
{ name: 'Salma Ben Amor', lane: 3, splits: [26.45, 55.13, 84.27, 112.81] },
{ name: 'Chloé Bernard', lane: 4, splits: [27.34, 55.77, 85.41, 113.71] },
{ name: 'Nour Khelifi', lane: 5, splits: [26.69, 55.37, 84.56, 113.73] },
{ name: 'Emma Petit', lane: 6, splits: [26.22, 55.13, 84.73, 113.56] },
{ name: 'Rim Saidi', lane: 7, splits: [27.19, 55.81, 85.17, 114.1] },
{ name: 'Julie Robert', lane: 8, splits: [27.25, 55.91, 85.48, 114.19] },
],
};
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 swimrace takes:
/** A swimming race: one lane each, splits at each wall, places and gaps. */
interface SwimRaceSpec extends Base {
type: 'swimrace';
/** `splits`: seconds at each wall, added up (the last one is the final time). */
swimmers: { name: string; lane?: number; splits: number[]; detail?: string; color?: string }[];
/** Length of the pool in metres: 50 by default. */
pool?: 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