ガントチャートGanttExperimental

Gantt / resource timeline: resource rows × a horizontal time axis with bars positioned by start/end and lane-packed within a row so overlapping bars stack instead of covering each other. A bar can carry internal segments[] (sub-spans tinted per segment — an aircraft rotation 便→折返し→便→整備, a crew duty 出区→乗務→入区, a shop visit 入場→検修→出場), with gaps showing as the bar's track. Day-column gridlines + date headers, a sticky row-label gutter, an optional today line, and a contained horizontal scroll. Owns the time math (pass startDate/endDate + rows + items); today is injectable (SSR-safe). Bars are focusable buttons with a composed accessible name. For project schedules, production lines, room/equipment timelines, crew/aircraft rotations, delivery/route plans and any rows-over-time view.

プレビュー

21
22
23
24
6/25
26
27
28
第1ライン組立
第2ライン塗装
第3ライン検査

バーをクリックで選択。第2ラインの B-201 と B-202 は期間が重なり、行内で上下に詰めて表示。今日(6/24)に縦線。

機材繰り(segments[]で1本のバーを 便/折返し/整備 に分割)

06:00
07:00
08:00
09:00
10:00
11:00
12:00
13:00
14:00
15:00
JA801AB787-8
JA02XJA350-900
JA335JB737-800

終日でなく1日内の運用なので resolution="hour"=時刻目盛(HH:MM)。各機(登録記号)の1日を1本のバーで表し、内部を 便(info)/折返し(muted)/整備(warning)/折返し不足(destructive)に分割。セグメント間の隙間はバーの track として見える。

Props

表は横にスクロールできます
プロパティ初期値説明
rowsGanttRow[]-Resource lanes (left axis): { id, label, sublabel? }.
itemsGanttItem[]-Bars: { id, rowId, start, end, label, tone?, ariaLabel? }. start/end are 'YYYY-MM-DD' / 'YYYY-MM-DDTHH:mm' / Date. Overlapping bars in a row stack into lanes.
startDate / endDatestring | Date-Visible time window. The component computes the day columns and bar positions.
todaystring | Date-Date marked with a vertical line. Injectable so render stays SSR-safe (no internal new Date()).
laneHeightnumber28Height (px) of one bar lane.
rowLabelWidthnumber120Width (px) of the sticky row-label gutter.
dayWidthnumber44Min width (px) per day column (drives horizontal scroll).
onSelectItem(item) => void-A bar clicked.
labelReactNode-Accessible name for the chart.

Usage

import { Gantt, type GanttRow, type GanttItem } from "@gunjo/ui"

const rows: GanttRow[] = [
  { id: "l1", label: "第1ライン", sublabel: "組立" },
  { id: "l2", label: "第2ライン", sublabel: "塗装" },
]

const items: GanttItem[] = [
  { id: "j1", rowId: "l1", start: "2026-06-22", end: "2026-06-24", label: "A-101", tone: "info" },
  { id: "j3", rowId: "l2", start: "2026-06-22", end: "2026-06-25", label: "B-201", tone: "success" },
  { id: "j4", rowId: "l2", start: "2026-06-23", end: "2026-06-26", label: "B-202", tone: "warning" }, // overlaps → stacks
]

<Gantt
  rows={rows}
  items={items}
  startDate="2026-06-21"
  endDate="2026-06-29"
  today="2026-06-24"          // injectable — SSR-safe
  onSelectItem={(i) => openJob(i)}
/>

使用コンポーネント