ProSchedulerSign in

Timeline · Loading events

Long axis

Three months of hour columns — about 2,200 — across 200 rows. Columns are virtualized like rows: only those in view are drawn.

Live demo

Scroll far to the right · Drag an event

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

export function LongAxisDemo() {
  // Three months of hour columns (≈2,200) across 200 rows: only the columns
  // and rows in view are rendered.
  const data = useMemo(() => {
    const now = new Date()
    const months = [0, 1, 2].map((m) => bigTimeline(200, 10, new Date(now.getFullYear(), now.getMonth() + m, 1)))
    return {
      resources: months[0].resources,
      events: months.flatMap((month, m) => month.events.map((e) => ({ ...e, id: `${e.id}-${m}` }))),
    }
  }, [])
  const { events, handlers } = useEvents(data.events)
  return (
    <ProScheduler
      data={events}
      resources={data.resources}
      view={{ timeline: { type: "month", size: 3, resolutionHorizontal: "hour" } }}
      styleConfig={{ unitWidthPx: 32, fitToWidth: false }}
      height={560}
      {...handlers}
    />
  )
}

About this demo

Three months of hour columns — about 2,200 — across 200 rows. Columns are virtualized like rows: only those in view are drawn.

Things to try

  • Scroll far to the right
  • Drag an event

The props behind it are explained in Scales, ranges and zoom.

Use ProScheduler in your project