Skip to content

Room bookings ​

Meeting rooms over a day: bookings, free time and the share of the day taken. Good for offices, coworking spaces, schools and hospitals.

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

In your framework

import { Chart } from 'nervure/react';

const spec = {
  type: 'rooms',
  now: '14:20',
  rooms: [
    { name: 'Carthage', seats: 12 },
    { name: 'Dougga', seats: 8 },
    { name: 'Kerkouane', seats: 6 },
    { name: 'El Jem', seats: 4 },
    { name: 'Sbeitla', seats: 20 },
  ],
  bookings: [
    { room: 'Carthage', from: 12, to: 13.5, title: 'Client call', people: 4 },
    { room: 'Carthage', from: 17, to: 17.5, title: 'Client call', people: 4 },
    { room: 'Dougga', from: 8, to: 9, title: 'Budget review', people: 7 },
    { room: 'Dougga', from: 9.5, to: 10.5, title: 'Lunch talk', people: 3 },
    { room: 'Dougga', from: 13.5, to: 14.5, title: 'Lunch talk', people: 7 },
    { room: 'Dougga', from: 15, to: 15.5, title: 'Interview', people: 5 },
    { room: 'Dougga', from: 16.5, to: 17.5, title: 'Interview', people: 3 },
    { room: 'Kerkouane', from: 9.5, to: 11, title: 'Budget review', people: 5 },
    { room: 'Kerkouane', from: 11, to: 12, title: 'Design review', people: 5 },
    { room: 'Kerkouane', from: 13.5, to: 14.5, title: 'Training', people: 4 },
    { room: 'Kerkouane', from: 15.5, to: 16.5, title: 'Lunch talk', people: 3 },
    { room: 'Kerkouane', from: 17.5, to: 19, title: 'Weekly team', people: 2 },
    { room: 'El Jem', from: 9, to: 11, title: 'Weekly team', people: 4 },
    { room: 'El Jem', from: 12, to: 13, title: 'Budget review', people: 3 },
    { room: 'El Jem', from: 16, to: 18, title: 'Interview', people: 4 },
    { room: 'Sbeitla', from: 8, to: 8.5, title: 'Budget review', people: 11 },
    { room: 'Sbeitla', from: 9.5, to: 10.5, title: 'Budget review', people: 15 },
    { room: 'Sbeitla', from: 12, to: 13, title: 'Weekly team', people: 6 },
    { room: 'Sbeitla', from: 14, to: 15.5, title: 'Weekly team', people: 13 },
    { room: 'Sbeitla', from: 16.5, to: 18, title: 'Design review', people: 3 },
  ],
};

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

/** Meeting rooms over a day: bookings, free time and how much of the day each room is taken. */
interface RoomsSpec extends Base {
  type: 'rooms';
  rooms: { name: string; seats?: number }[];
  bookings: RoomBooking[];
  /** First and last hour shown: 8 and 19 by default. */
  start?: number;
  end?: number;
  /** A line at this time. */
  now?: string | number;
  onItemClick?: (room: string) => void;
}

interface RoomBooking {
  room: 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