Skip to content

Lift traffic ​

The floors of a building, where each lift is, and the trips going up and down from each floor. Good for office towers, hotels and hospitals.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'lift',
  floors: [
    { name: '11', up: 14, down: 32 },
    { name: '10', up: 6, down: 37 },
    { name: '9', up: 5, down: 20 },
    { name: '8', up: 16, down: 39 },
    { name: '7', up: 7, down: 25 },
    { name: '6', up: 7, down: 24 },
    { name: '5', up: 24, down: 16 },
    { name: '4', up: 16, down: 15 },
    { name: '3', up: 11, down: 25 },
    { name: '2', up: 8, down: 48 },
    { name: '1', up: 2, down: 34 },
    { name: 'G', up: 187, down: 4 },
    { name: 'B1', up: 55, down: 1 },
  ],
  cars: [
    { name: 'A', floor: 'G', going: 'up', load: 0.59 },
    { name: 'B', floor: '7', going: 'down', load: 0.45 },
    { name: 'C', floor: '10', load: 0 },
  ],
};

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

/** Lifts of a building: where each car is and how many trips go up and down from each floor. */
interface LiftSpec extends Base {
  type: 'lift';
  /** From the top floor to the ground; `up` and `down`: trips started at that floor. */
  floors: { name: string; up?: number; down?: number }[];
  /** Each car, at the name of a floor. `load` from 0 to 1. */
  cars?: { name: string; floor: string; going?: 'up' | 'down'; load?: number }[];
  onItemClick?: (floor: string) => void;
}

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