Skip to content

Route steps ​

The steps of a way on foot, a turn and a distance each, and where you are. Good for stations, airports, hospitals and campuses.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'wayfinding',
  current: 2,
  steps: [
    { turn: 'start', text: 'Leave the train at platform 2', landmark: 'Gare de Lyon-Part-Dieu' },
    { turn: 'straight', text: 'Follow the signs to Hall B', distance: 109 },
    { turn: 'lift', text: 'Take the lift to level 2', landmark: 'Lift 3' },
    { turn: 'right', text: 'Turn right after the café', distance: 33 },
    { turn: 'slight-left', text: 'Pass the shops', distance: 74 },
    { turn: 'stairs-up', text: 'Go up to the gates', distance: 20 },
    { turn: 'left', text: 'Turn left at the screens', distance: 22 },
    { turn: 'arrive', text: 'Gate B12', landmark: 'On your right' },
  ],
};

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

/** Route steps indoors or on foot: a turn, a sentence and a distance each. */
interface WayfindingSpec extends Base {
  type: 'wayfinding';
  steps: WayStep[];
  /** Index of the step the reader is at. */
  current?: number;
  /** Metres a minute, to tell times: 80 by default. */
  speed?: number;
  /** Called with the index of the step. */
  onItemClick?: (id: string) => void;
}

interface WayStep {
  turn: Turn;

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