ProSchedulerSign in

Timeline · Loading events

Large dataset

Up to a thousand rows and twelve thousand events. Rows are virtualized, so only the ones in view are drawn.

Live demo

Switch to 1000 resources · Scroll to the bottom

Fullscreen
import { useMemo, useState } from "react"
import { ProScheduler } from "@andreisaac/pro-scheduler"
import { bigTimeline } from "./data/generate"
import { Choice, Toolbar, useEvents, when } from "./kit"

export function LargeDatasetDemo() {
  const [size, setSize] = useState(500)
  const dataset = useMemo(() => bigTimeline(size, 12), [size])
  const { events, setEvents, handlers } = useEvents(dataset.events)
  const [shownFor, setShownFor] = useState(dataset)

  // Swap the data when the size changes (state adjusted during render).
  if (shownFor !== dataset) {
    setShownFor(dataset)
    setEvents(dataset.events)
  }

  return (
    <div className="docs-demo__stack">
      <Toolbar label="Dataset">
        {[100, 500, 1000].map((n) => (
          <Choice key={n} active={size === n} onClick={() => setSize(n)}>
            {n} resources
          </Choice>
        ))}
        <span className="demo-muted">{events.length.toLocaleString()} events</span>
      </Toolbar>
      <ProScheduler
        data={events}
        resources={dataset.resources}
        view={{ timeline: { type: "month" } }}
        styleConfig={{ laneHeight: 22, laneGap: 2, rowPadding: 4, minRowHeight: 30, resourceColWidth: 150 }}
        height={560}
        {...handlers}
      />
    </div>
  )
}

About this demo

Up to a thousand rows and twelve thousand events. Rows are virtualized, so only the ones in view are drawn.

Things to try

  • Switch to 1000 resources
  • Scroll to the bottom

The props behind it are explained in Views.

Use ProScheduler in your project