Skip to content

Match timeline ​

Goals, cards and changes minute by minute, one team above the line and the other under it. Good for match reports and live pages.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'matchline',
  home: { name: 'Sfax Lions', color: '#c8384f' },
  away: { name: 'Bizerte Port', color: '#2f5fae' },
  events: [
    { minute: 14, team: 'home', kind: 'goal', player: 'Rami Jaziri' },
    { minute: 29, team: 'away', kind: 'yellow', player: 'Hugo Lefèvre' },
    { minute: 39, team: 'away', kind: 'goal', player: 'Lucas Moreau' },
    { minute: 46, team: 'home', kind: 'sub', player: 'Omar Gharbi', detail: 'for Adel Saidi' },
    { minute: 58, team: 'home', kind: 'penalty', player: 'Karim Ben Ali' },
    { minute: 64, team: 'away', kind: 'sub', player: 'Théo Garnier', detail: 'for Nathan Roux' },
    { minute: 72, team: 'home', kind: 'yellow', player: 'Nader Ferchichi' },
    { minute: 82, team: 'away', kind: 'red', player: 'Hugo Lefèvre', detail: 'second yellow' },
    { minute: 88, team: 'home', kind: 'goal', player: 'Omar Gharbi' },
  ],
};

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

/** What happened in a match, minute by minute: goals, cards, changes. */
interface MatchLineSpec extends Base {
  type: 'matchline';
  home: Side;
  away: Side;
  events: { minute: number; team: 'home' | 'away'; kind: MatchEventKind; player: string; detail?: string }[];
  /** Minutes of the match: 90 by default. */
  length?: number;
}

/** A team or a player facing another. */
interface Side {
  name: string;

type MatchEventKind = 'goal' | 'penalty' | 'owngoal' | 'miss' | 'yellow' | 'red' | 'sub';

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