Skip to content

Departures board ​

Times, destinations, platforms and delays, on a board that flips row by row. Good for stations, airports, bus stops and any screen of what leaves next.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'departures',
  now: '08:04',
  data: [
    { time: '08:13', destination: 'Sousse', line: 'G 53', platform: '2', delay: 0, cancelled: false, status: 'Boarding' },
    { time: '08:18', destination: 'Sfax', line: 'A 57', platform: '2', delay: 0, cancelled: false },
    { time: '08:24', destination: 'Bizerte', line: 'B 28', platform: '6', delay: 0, cancelled: false },
    { time: '08:28', destination: 'Nabeul', line: 'G 10', platform: '3', delay: 8, cancelled: false },
    { time: '08:34', destination: 'Gabès', line: 'A 11', platform: '3', delay: 16, cancelled: false },
    { time: '08:42', destination: 'Monastir', line: 'B 26', platform: '3', delay: 0, cancelled: true },
    { time: '08:51', destination: 'Hammam-Lif', line: 'G 29', platform: '4', delay: 11, cancelled: false },
    { time: '08:56', destination: 'Borj Cédria', line: 'A 35', platform: '3', delay: 24, cancelled: false },
  ],
};

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

/** Departures board: times, destinations, platforms and delays. */
interface DeparturesSpec extends Base {
  type: 'departures';
  data: Departure[];
  /** Name of the board: 'Departures' by default. */
  board?: string;
  /** Clock written at the top right: '08:31'. */
  now?: string;
  onItemClick?: (id: string) => void;
}

interface Departure {
  /** '08:42'. */
  time: 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