日本語
GanttChart
GanttChart は制御されたガントチャートとタイムラインです。時間軸上の行とバー、ラグ付きの FS・SS・FF・SF 依存関係、サマリーを集計する行グループ、ベースライン、列、リソース負荷のヒストグラム、ステータス日と進捗線、スプレッドシート編集を備えています。生産計画、プロジェクトの日程、設備のタイムラインなど、半開区間 [start, end) で表せるものに使います。単位は自由に選べ(標準はミリ秒)、長さ 0 のバーはマイルストーンです。
rows や bars を自分で変更することはありません。ドラッグやキーボードの編集はプレビューされたあと edit の提案として emit され、validateEdit で同期的に拒否できます。操作の途中でデータが変わると、その操作はキャンセルされます。チャートは渡されたものを描くだけなので、日付の計算には scheduleTasks を使い、その結果を渡します。
最小の例
vue
<script setup lang="ts">
import { ref } from 'vue'
import { GanttChart, type TimelineBar, type TimelineEdit } from '@eightkk/vue-weave'
import '@eightkk/vue-weave/style.css'
const start = Date.parse('2026-11-09T08:00:00Z')
const hour = 3_600_000
const range = { start, end: start + 8 * hour }
const rows = [{ id: 'team', label: '開発チーム' }]
const bars = ref<TimelineBar[]>([
{ id: 'build', rowId: 'team', label: '製作', start: start + hour, end: start + 3 * hour, editable: true, progress: 0.4 },
])
function commit(change: TimelineEdit) {
bars.value = bars.value.map(bar => bar.id === change.id ? { ...bar, ...change.after } : bar)
}
</script>
<template>
<GanttChart :rows="rows" :bars="bars" :range="range" @edit="commit" />
</template>例: スケジューリング、連動ビュー、建設工程、例の一覧。ガイド: スケジューリング、データ、保存、連動ビュー。型: TimelineRow、TimelineBar、TimelineEdit、GanttChartExposed。時間軸と編集の補助関数はタイムラインと時間軸にあります。
英語の詳細
ここから下の詳細なリファレンスは英語です。
GanttChart
| Prop | Type / default | Meaning |
|---|---|---|
| rows | readonly R[] (R extends TimelineRow) / required | ID, label, optional detail and data. R is inferred; see Typed data |
| bars | readonly B[] (B extends TimelineBar) / required | ID, rowId, label, numeric start/end and optional attributes. B is inferred |
| range | TimeRange / required | Visible axis bounds; finite start < end |
| dependencies | readonly TimelineDependency[] / [] | ID, from/to bar IDs, optional FS/SS/FF/SF type and optional lag (see Dependency lag) |
| highlightedDependencyIds | ReadonlySet<string> / undefined | Highlight link IDs using --vw-dependency-highlight |
| selectedIds | ReadonlySet<string> / undefined | Controlled highlighted bars |
| pixelsPerUnit | number / 80 per hour in milliseconds | Base linear time scale |
| scale | TimeScale / undefined | Custom mapping before component zoom |
| tickSteps | readonly number[] / 30m, 1h, 2h, 4h, 24h | Positive ascending intervals in the same units as data. The chart uses the first step whose narrowest visible tick spacing is at least 76 px, and draws one grid line at each tick's scale position, as the SVG export does. A tick label is shown only when the next tick is at least 76 px further on (the closing label: the previous tick 76 px back), so where no step fits everywhere, for example in the squeezed non-working time of a createWorkingTimeScale axis, those labels are left out instead of overlapping; their grid lines stay, and the SVG export leaves out the same labels |
| snap | number / 900000 | Edit displacement step; 15 minutes in milliseconds. Must be finite and greater than 0 (the active zoom preset's snap replaces it), otherwise validation-error reports RangeError: snap must be finite and positive |
| minDuration | number / snap | Minimum duration for resizing. Must be finite and greater than 0 and may be smaller or larger than snap, otherwise validation-error reports RangeError: minDuration must be finite and positive; when snap is also invalid, the snap error is reported |
| editBounds | TimeRange / range | Bounds for edit proposals |
| formatTime | (number) => string / UTC HH:mm | Tick labels and accessible bar labels |
| formatLag | (number) => string / formatDependencyLag | Text of a non-zero dependency lag on its connector and in its description; see Dependency lag |
| baselineIds, baselineLabel, formatVariance | readonly string[] / the first 3 of timelineBaselineIds(bars), (id: string) => string / labels.baseline or the set ID, (number) => string / formatDependencyLag | Which baseline sets are drawn and in what order, their names and the text of their variance; see Baseline sets |
| rowHeight | number / 66 | Fixed row height, at least 8 + laneCount × 14 |
| laneCount | integer / 1 | Lanes per row |
| height | number or CSS string / 316px | Scroll viewport height |
| readonly | boolean / false | Disables editing |
| validateEdit | EditValidator / undefined | Synchronous hook accepting or rejecting a proposal: true or undefined accepts, false (default labels.rejected) or a reason string rejects; a blank or whitespace-only string rejects with the default message. Every GanttChart validator follows this convention with its own default message |
| labels | Partial<GanttLabels> / English | region, rows, empty, zoom, zoomIn, zoomOut, editHint, rejected, plus the optional fields described in the sections below (for example progressOf and deleteHint) |
| showControls | boolean / true | Zoom buttons |
| autoScroll | boolean / true | Scrolls the timeline horizontally while a pointer drag is held near the left or right edge of the viewport. Set false to disable |
| dir | ChartDirection / ltr | rtl or auto places row headings on the right and runs time from right to left; see Right-to-left layout |
| nonWorkingPeriods | readonly TimeRange[] / undefined | Shades non-working time behind the grid; see Calendar shading, critical path, float and segments |
| markerRanges | readonly TimelineMarkerRange[] / undefined | Highlighted half-open time ranges: a band across the body or selected rows with a label in the header; see Marker ranges |
| progressEditable, progressStep, validateProgressEdit | boolean / false, number / 0.05, ProgressEditValidator / undefined | Progress slider proposals; see Progress editing, deletion, tooltips, context menu and fit |
| deletable, validateBarsDelete | boolean / false, BarsDeleteValidator / undefined | Delete or Backspace proposes removing bars; see the same section |
| tooltipDelay | number / 400 | Hover delay in milliseconds of the opt-in tooltip slot |
| dependencyStyle | DependencyPathStyle / 'orthogonal' | Shape of the dependency connectors: orthogonal (right angles), rounded (right angles with 6 px rounded corners) or curve (a smooth curve). Every style leaves the source and enters the target horizontally. Any other value is reported through validation-error. The export methods draw the same shape |
| stickyBandLabels | boolean / false | While the timeline is scrolled, a headerBands interval that starts before the visible part of the axis indents its label (text-indent) to the visible start, so the label stays in view until its band ends. Server rendering and an unscrolled chart indent nothing |
| contextMenu | boolean / false | Emits context-menu instead of opening the browser menu; see the same section |
| creatable, createDuration, validateCreate | boolean or (row: R) => boolean / false, number / 4 × snap, CreateValidator / undefined | A drag or click on an empty part of a row, or its add button, proposes a new bar; see Drag to create and cascade previews |
| cascade | TimelineCascade / undefined | Follow-on changes of other bars for a move or resize, previewed during a drag and proposed with it as one batch; see the same section |
| rowsReorderable, validateRowMove | boolean / false, RowMoveValidator / undefined | A move handle on each row heading proposes row hierarchy moves by pointer drag or Alt+arrow keys; see Row hierarchy moves, status date and progress line |
| statusDate, showProgressLine | number / undefined, boolean / false | Draws a labelled status-date line and, with showProgressLine, a progress line; see the same section |
| constraintsEditable, validateConstraintEdit | boolean / false, ConstraintEditValidator / undefined | Handles at the constraints of editable bars propose moves and removals through constraint-edit; see Scheduling constraints |
| columnsResizable, labelWidth, minColumnWidth, maxColumnWidth, validateColumnResize | boolean / false, number / undefined (the --vw-row-label-width theme value), number / 48, number / 800, ColumnResizeValidator / undefined | Resize separators on the row label column and each extra column propose new widths by pointer drag or arrow keys; see Column resizing |
| sortableColumns, sort | boolean or readonly string[] / false, readonly TimelineViewSort[] / undefined | Header sort buttons that propose the next sort through update:sort (v-model:sort); see Header sorting and filtering |
| filterableColumns, filters | boolean or readonly string[] / false, readonly TimelineViewFilter[] / undefined | Header filter buttons with a small dialog that propose column filters through update:filters (v-model:filters); see the same section |
| highlightedBarIds | ReadonlySet<string> / undefined | Display-only highlight of bars (vw-is-highlighted, --vw-bar-highlight), separate from selectedIds; see Linked views, reveal and external drops |
| loadSelectable | boolean / false | Makes load segments focusable buttons that report target events; see the same section |
| highlightedLoadTargets, selectedLoadTargets | readonly LoadViewTarget[] / undefined | Display-only highlight (vw-is-highlighted) and selected state (vw-is-selected) of the load segments that overlap these resource time ranges; see the same section |
| droppable | boolean / false | Accepts HTML drag and drop and emits bar-drop(TimelineDrop); see the same section |
| validateFieldEdit | (change: TimelineFieldEdit<R>) => boolean | string | void / undefined | Synchronous check of a typed field proposal from a column with field; see Timeline columns and rollups |
| visibleWindowDelay | number / 100 | Milliseconds the visible-window-change event waits for the window to settle; see Partial data loading |
TimelineRow<D> has id, optional parentId, label, optional detail and data (D, default unknown). TimelineBar<D> adds lane (zero-based, default 0), tone, appearance (solid/outline), editable (default false), progress (0–1) and data (D, default unknown), plus baseline and baselines (see Timeline planning overlays and Baseline sets), the optional critical, latestEnd, deadline, segments and description fields described in Calendar shading, critical path, float and segments, constraints, described in Scheduling constraints, and deletable (default editable), described in Progress editing, deletion, tooltips, context menu and fit. A zero-duration bar is a milestone, drawn as a diamond. With a bar slot, a milestone gets vw-has-slot and draws the diamond behind the slot content (a ::before layer) instead of clipping the button, so the slot can place text or icons beside it; without a slot the milestone is drawn as a plain diamond. Equal start/end intervals can move; resize handles require duration >= minDuration. Intervals use half-open [start,end) visibility; a milestone exactly at the axis end is outside the displayed window.
Display bars may extend beyond the axis. Editing is enabled only for intervals contained in editBounds. With custom numeric units, supply matching pixelsPerUnit, tickSteps, snap and formatTime.
Dependencies connect explicit endpoints. FS means source finish to target start; SS start to start; FF finish to finish; SF start to finish. These paths visualize relationships. Your application can enforce scheduling constraints in validateEdit or an authoritative backend.
Editing contract
select(id, detail) reports a bar activated by click or keyboard (Enter/Space). It fires once per click, on release, including after a drag; detail (TimelineSelectDetail) has dragged, true when the click ended a pointer drag of that bar, which proposed a move or resize through edit (or was rejected). Use it to keep a message about the edit instead of replacing it with the selection. validation-error(error) fires when rows (including missing parents and hierarchy cycles), bars, dependencies, range, scale, pixelsPerUnit, snap, minDuration, rowHeight, laneCount, tickSteps, nonWorkingPeriods, progressStep, tooltipDelay, createDuration, statusDate, labelWidth, minColumnWidth or maxColumnWidth are invalid, when zoomPresets have an invalid or duplicate ID (Error) or a pixelsPerUnit that is not finite and positive (RangeError), when columns have an invalid or duplicate ID (Error) or a width that is not finite and positive (RangeError), when headerBands (or those of the active zoom preset) are not finite, ordered and nonoverlapping within a level (RangeError), when markers have an invalid or duplicate ID (Error) or a non-finite time (RangeError), when loadRows have an invalid or duplicate ID (Error), when markerRanges have a missing or duplicate ID (Error), endpoints that are not finite numbers with start < end (RangeError) or an unknown row in rowIds (Error), when baselineIds has an empty or duplicate ID or more than three IDs, when a column uses the reserved ID timelineLabelColumnId while columnsResizable is set or sortableColumns or filterableColumns names a column, or when a sortableColumns or filterableColumns list names an unknown column (Error, Unknown column in sortableColumns: finish). The chart then renders its empty state instead of the invalid data, and the error is still rethrown inside the component so development builds surface it. A later valid update clears the state. edit(change) reports a proposal with the following shape.
ts
interface TimelineEdit {
id: string
before: { start: number; end: number }
after: { start: number; end: number }
mode: 'move' | 'start' | 'end'
source: 'pointer' | 'keyboard'
}validateEdit returns true/undefined to accept, false for the default rejection message, or a string for a specific rejection message. Rejection emits edit-rejected(change, reason) and announces the message in a live region. The callback is synchronous. Perform asynchronous persistence in the edit listener. The component never mutates incoming bars.
Pointer cancellation, loss of capture and Escape discard the preview. Changes to source bars, rows, bounds or the coordinate system cancel an active drag. Every such cancellation of an edit in flight is reported through the additive edit-cancel(TimelineEditCancel) event: reason is escape (Escape, a cell-editor cancel, or opening another cell editor), pointer-cancel (pointer cancellation or loss of capture, a second touch, a context menu during a gesture), source-changed (new source data, bounds, zoom or direction), hidden (the gesture's bar or row, or the edited cell's row, is no longer displayed, for example after collapsing) or api (the parent called cancelEdit()); barIds lists the bars of the gesture (empty for a create, row, column or cell edit) and cell names the cell of a cancelled cell-editor. In-flight edits are pointer gestures (with spreadsheet, also a fill handle drag, reported with empty barIds), an armed connection and an open cell-editor; nothing is emitted when none is in flight, and a gesture that ends with a proposal emits no edit-cancel. These props are watched by reference, so pass new arrays and objects instead of mutating them in place. range, editBounds and tickSteps are compared by value: a new but equal object or array, such as an inline literal in a parent template, neither re-runs validation nor cancels a drag. scale keeps reference semantics. A drag, connection or other pointer gesture belongs to one pointer; while it is in flight, a press of another pointer (for example a pen next to the mouse) starts nothing. While a drag is held near the horizontal edge of the viewport, the timeline scrolls and the preview follows the pointer (autoScroll). A focused bar stays rendered even when an edit moves it outside the visible window, and after a keyboard edit is applied the chart scrolls horizontally only if the bar's new range is outside the viewport. Selection does not change the source intervals. Arrow keys move focused editable intervals by snap; Shift changes the end; Alt changes the start. Move snapping uses displacement relative to the original interval, so an off-grid start retains its offset. A zoom change (the zoom buttons, a preset, Ctrl+wheel, pinch or fitToBars) ends the pointer gestures that preview times (move, resize, progress, constraint, connection drag and create) with source-changed; row and column drags, a fill handle drag and a connection armed from the keyboard go on. While a bar move or resize or a drag to create is in flight, the zoom buttons and presets do nothing. A fill handle drag ends with edit-cancel on Escape, cancelEdit(), new rows or columns, a collapse, or a change of readonly or spreadsheet; new bars and props that do not change the rows (such as now, markers or tooltipDelay) leave it running. Bar keys do not edit, and a bar press starts no drag, while a pointer gesture or an armed connection is in flight. After a keyboard row move (rowDraggable) that the parent applies, focus follows the bar to its new row; a rejected move, or one the parent has not applied by the time the bar loses focus, moves no focus later.
Slots are legend(), row-heading(), row({row,index}), bar({bar,range,selected}), tick({time,label}), empty(), the opt-in tooltip({bar,range,selected}) and cell-editor (see Timeline columns and rollups). The bar slot is inside a button. Use noninteractive content inside it. Keep row and bar slot contents within the configured dimensions. Methods are scrollToTime(time), scrollToRow(rowId), cancelEdit(), exportSvg(options), exportPng(options), fitToBars(ids, options) and revealBar(id, options); see Export to SVG and PNG, Progress editing, deletion, tooltips, context menu and fit and Linked views, reveal and external drops. cancelEdit() also closes an open cell-editor and reports edit-cancel with reason api.
Related exported types: TimelineEditCancelReason.
Timeline planning overlays
| API | Behavior |
|---|---|
| TimelineRow.parentId | Optional existing row ID. The tree is rendered in preorder. Siblings follow input order. |
| collapsedIds / update:collapsedIds | Optional controlled set of collapsed row IDs. The component manages the set when the prop is omitted. |
| TimelineBar.baseline | Optional original start/end interval. Drawn below the bar and independent of edits to the main interval. It is the baseline set timelineBaselineId; for several named sets see Baseline sets. |
| headerBands | Array of header levels, each with ordered non-overlapping intervals containing start, end and label. Levels appear above the default ticks. |
| markers | Array of unique IDs with finite time and label. Drawn as vertical markers in the visible time window. |
The row slot also receives depth and expanded. The row index refers to the expanded view. Links with hidden endpoints disappear while the group is collapsed. scrollToRow targets expanded rows. Any summary interval or progress can be supplied as a bar on the parent row. The optional GanttLabels fields expandRow, collapseRow and baseline localize these additions. CSS variables --vw-baseline and --vw-marker theme the overlays.
Related exported types: TimelineBand.
Baseline sets
A bar can carry several saved baselines, for example the original plan and a revision, and the chart can draw up to three of them at once. Charts whose bars only use TimelineBar.baseline and that do not set baselineIds draw that one strip per bar, without variance in titles or descriptions.
| API | Behavior |
|---|---|
| TimelineBar.baselines | Optional readonly TimelineBaseline[]. A TimelineBaseline is a TimeRange with an id that names its set (for example plan or rev1). Each bar has at most one entry per set, with finite start and end and end >= start (a zero-length baseline is drawn like a milestone baseline). The set ID timelineBaselineId ('$baseline') is reserved. validateTimelineData throws an Error for a missing, empty, duplicate or reserved set ID or a value that is not an array, and a RangeError for invalid times, so the chart reports them through validation-error. |
| TimelineBar.baseline | The single unnamed baseline. It takes part in selection as the set timelineBaselineId and can be combined with baselines; it keeps its meaning and its default label labels.baseline. |
| baselineIds | The sets to draw, in slot order: up to timelineBaselineLimit (3) unique nonempty IDs, with timelineBaselineId for baseline. An ID that no bar has keeps its slot, so a set does not move while data changes. [] draws no baselines at all. When omitted, the chart draws the first three IDs of timelineBaselineIds(bars): timelineBaselineId when any bar has a baseline, then the named sets in order of first appearance; further sets are not drawn. Compared by value, like range. More than three IDs, an empty ID or a duplicate is a validation error. |
| baselineLabel(id) | Name of a set in titles and descriptions. Default: labels.baseline ("Baseline") for timelineBaselineId and the set ID otherwise. |
| formatVariance(delta) | Text of a variance in titles and descriptions. Default formatDependencyLag, signed hours of milliseconds such as +2 h; charts in other units should pass their own. |
| GanttLabels.baselineStart, baselineFinish, baselineDuration | Words before the three variances. Defaults "start", "finish" and "duration". |
Layout. With one selected set the strip is drawn as a single baseline: 4 px high, 1 px below the bar. With two or three selected sets every lane keeps its height and the row height never changes: the strips are 3 px high and 1 px apart, slot 1 directly below the bar, and the bars are drawn shorter so the strips fit in the lane (3 px shorter for two sets and 7 px for three, which is 4 × n − 5). Dependency ends, float lines, deadline indicators and the progress line follow the shorter bars. Use a rowHeight that leaves the bars enough height with three sets (the default 66 gives 45 px bars; the minimum 8 + laneCount × 14 leaves 1 px). The number of selected IDs decides the layout, not the number of sets a bar has, so all bars keep the same height and every set keeps its slot. A selection change that changes the bar height cancels a gesture in flight, like other coordinate changes.
Styling. Each strip has the class vw-gantt-baseline. With two or three sets it also has vw-gantt-baseline-1, -2 or -3 for its slot, coloured with --vw-baseline, --vw-baseline-2 and --vw-baseline-3, and in forced-colors mode with GrayText, CanvasText and a dashed CanvasText strip. Whenever named sets are present or baselineIds is set, each strip also carries data-vw-baseline with its set ID, for application styles per set. In right-to-left charts the strips are mirrored with the bars; they are printed with exact colours like the rest of the chart.
Accessibility and variance. A strip is not focusable and has a title: Baseline · <bar label> <start>–<end> for the single baseline. Whenever named sets are present or baselineIds is set, the title adds the variance (<set label> · <bar label> <start>–<end> · start +1 h, finish +1 h, duration +0 h) and each drawn set of a bar is added, in slot order, to the bar's description (aria-describedby, after the critical, float, deadline and late entries), for example Plan 09:00–11:00: start +0.5 h, finish +0.5 h, duration +0 h. Accessible names do not change. The variance is baselineVariance(bar, baseline) against the bar as drawn, so it follows a drag preview. A tooltip slot can show the same numbers with baselineVariance and timelineBaseline.
Summaries. Summary rows (showSummaries) do not roll up baselines: supply a bar on the parent row with its own baseline or baselines to show a summary baseline.
Export. exportSvg, exportPng and renderTimelineSvg draw the same sets with the same layout, colours (theme baseline, baseline2 and baseline3) and titles; renderTimelineSvg takes baselineIds, baselineLabel, formatVariance and varianceLabels options. toMsProjectXml writes numbered baselines (MsProjectTask.baselines); see Interchange exports.
ts
import { baselineVariance, timelineBaseline } from '@eightkk/vue-weave/core'
const bars = tasks.map(task => ({
id: task.id, rowId: task.id, label: task.name, start: task.start, end: task.end,
baselines: [{ id: 'plan', ...task.planned }, { id: 'rev1', ...task.revised }],
}))
// <GanttChart :bars="bars" :baseline-ids="['plan', 'rev1']" :baseline-label="id => names[id]" ... />
const slip = baselineVariance(bars[0], timelineBaseline(bars[0], 'plan')!).endTimeline columns and rollups
| API | Behavior |
|---|---|
| columns | Extra sticky columns (TimelineColumn<R>) described by id, label, width in pixels, value(row, summary) and optional editable. An editable predicate can limit editing to individual rows. Both callbacks receive the chart's row type R. |
| cell-edit(change) | Proposes rowId, columnId, before and after. The input supplies after as a string. The parent converts, validates and persists the value as needed. |
| validateCellEdit / cell-edit-rejected | Uses the same accept or reject convention as bar edits. Rejection retains the accepted cell value and reports the reason. |
| cell slot | Customize the cell using row, column, value and summary. A custom editor owns its interaction and persistence. |
| showSummaries | Draw an aggregated interval on a parent row without an explicit bar. Collapse hides descendants and preserves the parent rollup. |
| summaryDependencies | Opt-in, default false. A dependency end may name a summary row instead of a bar, and is drawn to the edge of the row's rollup bar. See Dependencies on summary rows. |
| TimelineColumn.field | Optional TimelineFieldSpec<R> (see Typed fields and timeline views). An editable column with field proposes typed values through field-edit only; it never emits cell-edit. |
| field-edit(change) | TimelineFieldEdit<R>: rowId, columnId, fieldId, before (field.get(row)), after (a checked FieldValue, never the raw text) and source. A value equal to before (fieldValuesEqual) proposes nothing. |
| validateFieldEdit / field-edit-rejected(change, reason) | Same accept or reject convention as bar edits; false uses GanttLabels.rejected. The reason is announced in the live region. |
| cell-editor slot | Editor of a field cell: row (R), column (TimelineColumn<R>), field, value (the current raw value), draft (the value of the last failed commit, initially value), validation (FieldCheck, { ok: true } until a commit fails), error (its message), source (how the editor was opened), commit(value, source?), commitText(text, source?) and cancel(). |
Enter or blur submits a default editor and Escape discards the input. Enter and Escape that belong to an input method composition (KeyboardEvent.isComposing, or keyCode 229), such as the Enter that confirms a Japanese conversion, are left to the input method in every built-in cell input and in the Escape handling around cell-editor: they neither commit nor cancel, and the text and focus stay; a later Enter commits. The built-in inputs keep the text being typed, composed text included, as a draft while the chart re-renders for other reasons (new bars, row height, selection); only a commit, Escape, or new source text for that cell (a changed column.value, or field.get for a typed field) replaces it, and the last one discards the draft. A cell-editor slot that commits on its own keys should check isComposing itself. The chart-level readonly prop disables editing. Keep the sticky columns narrow enough to leave room for the timeline.
Which element edits a cell:
| Column | cell slot given | No cell slot, cell-editor slot given | Neither slot |
|---|---|---|---|
without field | The cell slot owns the cell | The built-in text input; cell-editor is not used | The built-in text input, emitting cell-edit |
with field | The cell slot owns the cell (the slot takes precedence); cell-editor is not used and nothing is emitted for it | A button with the cell value opens cell-editor; only field-edit is emitted | The built-in text input shows formatFieldValue(field, field.get(row)) and parses the text with parseFieldValue; only field-edit is emitted |
Setting field therefore moves a column from cell-edit to field-edit. The field cell button (vw-field-cell, named "row label · column label value") opens the editor on click, Enter, Space or F2, and focus moves into the editor's first focusable element. commit(value) checks the value with validateFieldValue and validateFieldEdit; on success it emits field-edit, closes the editor and returns focus to the cell button, and on failure it keeps the editor open with validation and error set and announces the reason. It returns the FieldCheck. A value equal to value (fieldValuesEqual) closes the editor without a proposal and without validation. commitText(text) parses the text with the field first; text equal to formatFieldValue(field, value) commits value unchanged without parsing. cancel() and Escape (unless the slot content already handled it with preventDefault) close the editor without a proposal, return focus to the cell and emit edit-cancel with reason escape. A key that commits or cancels does not also activate the cell button. Focus leaving the editor does not close it. New rows or columns, readonly, a change of the collapsed rows and cancelEdit() close an open editor with edit-cancel (source-changed, hidden or api); new bars do not. The built-in field input proposes on Enter or change with source keyboard; text left as the formatted current value ends the edit without a proposal (the value is not parsed back, so an unedited commit never changes it); text that cannot be parsed or fails the spec is kept, marked aria-invalid and announced, and Escape restores the formatted value. Read-only field cells show column.value as plain text, like other cells.
Related exported types: TimelineCellEdit, TimelineSummary.
Spreadsheet editing
Opt-in with spreadsheet. The built-in cells of the extra columns become a sheet: each cell is a button (vw-sheet-cell, named "row label · column label value", aria-pressed while selected, described by GanttLabels.sheetHint) with one Tab stop for the whole sheet (the active cell). The sheet covers the displayed rows in order, including rows scrolled out of the virtual window and excluding descendants of collapsed rows; the row heading and the time axis are not part of it. A cell or cell-editor slot keeps ownership of its cells, which then are not sheet cells.
| API | Behavior |
|---|---|
| spreadsheet | boolean, default false. Enables everything below. Without it nothing changes. |
| Selection | Click selects a cell, Shift+click or a mouse drag a rectangle; Shift+arrows extend it, Ctrl/Cmd+A selects all cells and Escape collapses it to the active cell. Arrows, Home and End (Ctrl/Cmd for the first and last cell) move, Left and Right in the visual direction; Tab and Shift+Tab move along the row and leave the sheet past its first or last column. A touch tap selects one cell (Shift extends), so touch drags keep scrolling. |
| Editing one cell | Double-click, Enter or F2 opens the built-in editor with the value; typing a character opens it with that character. Enter commits and moves down (Shift+Enter up), Tab commits and moves along the row, Escape cancels and returns focus, and leaving the editor commits. Text a field cannot read keeps the editor open. These commits emit the usual single-cell events (field-edit, cell-edit). Typing does not start an input method composition; use F2 or Enter first for one. |
| Clipboard | Ctrl/Cmd+C writes the selection as tab-separated text (formatSheetText). Ctrl/Cmd+V reads the clipboard text (parseSheetText) into the cells from the upper-left selected cell; one copied value fills the whole selection. Ctrl/Cmd+X copies, then clears. |
| Clear and fill | Delete or Backspace clears the selection (empty text, which a field reads as null or rejects when required). Ctrl/Cmd+D repeats the first selected row in the selected rows below it. Dragging the fill handle (vw-sheet-fill, the corner of the selection, by mouse, pen or touch) repeats the first selected row down to the row under the pointer, then selects the filled range. Values are repeated, never extrapolated. Escape, pointer cancellation, new rows or columns or a collapse cancel the drag without a proposal; the drag never emits bar-drop. |
| sheet-edit(change) | TimelineSheetEdit<R>: action (paste, fill or clear), fieldEdits (TimelineFieldEdit<R> for columns with field) and cellEdits (TimelineCellEdit for plain columns), in row then column order. Unchanged cells are left out, and an operation that changes nothing emits nothing. Field edits have source: 'pointer' for the fill handle and 'keyboard' otherwise. No single-cell event fires for a batch. Apply the whole batch as one step, for example with applyTimelineSheetEdit. |
| validateSheetEdit / sheet-edit-rejected(reason, change?) | The operation is rejected as a whole, and nothing is proposed, when a target cell is read-only (GanttLabels.sheetReadOnly), pasted records have different lengths (sheetRagged), the paste extends past the last row or column (sheetOutside), a field cannot read a text, or validateFieldEdit or validateCellEdit rejects one cell; the reason of a cell names it ("row · column: reason"). After those checks, validateSheetEdit(change) sees the whole batch with the usual accept or reject convention (false uses GanttLabels.sheetRejected), and change is passed with its rejection. The reason is announced in the live region; show it in the page as well. |
| GanttLabels.sheetHint, sheetReadOnly, sheetRagged, sheetOutside, sheetRejected | Localize the cell description and the rejection reasons. |
readonly keeps selection and copying but rejects every change and hides the fill handle. Related exported types: TimelineSheetEdit, TimelineSheetChanges, TimelineSheetAppliers. See Spreadsheet editing in a schedule for a complete example.
Column resizing
Opt-in with columnsResizable. Without it and without labelWidth, the chart adds no resize handles and uses its default column widths, and pointer, keyboard, events and names are not affected by this feature. Column widths stay controlled: the chart previews a drag and proposes the result, and the parent applies it.
| API | Behavior |
|---|---|
| columnsResizable | boolean, default false. A separator (vw-column-resize, role="separator", aria-orientation="vertical", focusable) sits on the inline-end edge of the row label column and of each columns header. Its accessible name is GanttLabels.resizeColumn (default "Resize column") followed by the column label, or by GanttLabels.rows for the label column, for example "Resize column Owner". aria-valuenow is the current width in pixels, aria-valuemin and aria-valuemax the limits. Separators are also drawn when readonly is set, because widths are not data. |
| labelWidth | number in pixels. Sets --vw-row-label-width on the chart canvas; without it the label column keeps the theme width (154 px, 106 px on narrow screens). Set it to accept a proposal for the label column. A value that is not finite and positive is reported through validation-error. |
| minColumnWidth, maxColumnWidth | Limits of every proposal in pixels, defaults 48 and 800. maxColumnWidth must not be below minColumnWidth. Existing widths outside the limits are drawn as given. |
| column-resize(change) | TimelineColumnResize: id (the TimelineColumn.id, or timelineLabelColumnId, '$label', for the row label column), before and after widths in pixels (whole numbers within the limits) and source (pointer or keyboard). Accept it by setting that column's width, or labelWidth for the label column. An unchanged width is not proposed. |
| validateColumnResize / column-resize-rejected(change, reason) | Synchronous ColumnResizeValidator. Accepts with true or undefined, rejects with false (default GanttLabels.columnResizeRejected, "This column resize was rejected.") or a reason string. The reason is announced in the live region. |
Keyboard. On a focused separator, ArrowRight and ArrowLeft move the column edge 10 px on screen (40 px with Shift): in left-to-right charts ArrowRight widens the column, in right-to-left charts, where the edge is on the left, ArrowLeft widens it. Home proposes the minimum and End the maximum width.
Pointer. Press the primary button (or touch) on a separator and drag horizontally. The column, the cells below it and the timeline follow the preview; the label width before the drag is the rendered one. Release proposes the previewed width with source: 'pointer'. Escape, pointer cancellation, lost capture, a change of columns, labelWidth, the limits, columnsResizable, the direction or the other source props listed in the editing contract cancel the drag without a proposal.
ts
import { timelineLabelColumnId, type TimelineColumn, type TimelineColumnResize } from '@eightkk/vue-weave/core'
const labelWidth = ref<number>()
function onColumnResize(change: TimelineColumnResize) {
if (change.id === timelineLabelColumnId) labelWidth.value = change.after
else columns.value = columns.value.map(column => column.id === change.id ? { ...column, width: change.after } : column)
}Header sorting and filtering
Opt-in with sortableColumns and filterableColumns. Without them the header markup, names and events are unchanged. Both take true (the row label column and every extra column) or a list of column IDs, with timelineLabelColumnId ('$label') for the row label column. The chart stays controlled: it shows the sort and filters props and proposes changes, and never reorders or filters rows itself. Apply the proposals to the rows, for example with useTimelineView (Typed fields and timeline views), whose projection sorts siblings within their parent and keeps the ancestors of filtered rows:
vue
<GanttChart :rows="view.projection.value.rows" :bars="view.projection.value.bars" :columns="columns" :range="range"
sortable-columns filterable-columns :sort="view.state.value.sort" :filters="view.state.value.filters ?? []"
@update:sort="view.setSort" @update:filters="view.setFilters" />| API | Behavior |
|---|---|
| Header cell | A header with a control gets the class vw-header-controls. The header is not a table row, so it has no columnheader role or aria-sort; the sort state is part of the sort button's name. sortableColumns and filterableColumns lists may name only timelineLabelColumnId and extra column IDs; an unknown ID is reported through validation-error, and an empty list adds no controls. |
| Sort button | vw-column-sort, named GanttLabels.sortBy (default "Sort by") and the column label, for example "Sort by Finish"; when sort has a rule for the column (first or later), GanttLabels.sortedAscending or GanttLabels.sortedDescending ("ascending", "descending") is added in parentheses ("Sort by Finish (ascending)") and the button gets vw-is-sorted and the ▲ or ▼ glyph. The label column uses GanttLabels.rows and keeps the row-heading slot inside the button. Click, Enter or Space proposes nextTimelineSort(sort, columnId): a column without a rule becomes the first rule, ascending; an ascending rule turns descending in place; a descending rule is removed. The other rules are kept. |
| update:sort(sort) | TimelineViewSort[]: the rules after nextTimelineSort; only the activated column's rule ({ ruleId: columnId, direction }) changes. |
| Filter button | vw-column-filter, aria-haspopup="dialog" and aria-expanded, named GanttLabels.filterBy (default "Filter") and the column label; when the column has a filter, GanttLabels.filtered in parentheses is added ("Filter Owner (filtered)") and the button gets vw-is-active. It opens or closes the filter dialog. |
| Filter dialog | vw-column-filter-popover, role="dialog" named like the button, opened under its header cell (logical properties, so it follows right-to-left charts). It holds a text box labelled GanttLabels.filterContains ("Contains"), focused on opening; for a column whose field is a select, a group of checkboxes labelled GanttLabels.filterValues ("Show values"), one per choice; and a GanttLabels.clearFilter ("Clear filter") button. Typing or toggling proposes the filters at once; text composed with an input method is proposed once, when the composition ends. Both stay controlled: after the parent handles a proposal, the text box and checkboxes show the applied filters again, so text the parent ignores is replaced by the applied text. Escape closes the dialog and returns focus to the filter button; a press outside the header cell or focus moving out of it closes it without moving focus. It is never rendered on the server. |
| update:filters(filters) | TimelineViewFilter[]: the new list, in which the column's filter is replaced in place, added at the end or removed when it has no condition left (empty or whitespace-only text and every choice shown). Other filters are copied unchanged. |
Keys typed in the dialog do not reach the chart's shortcuts. New rows from an applied sort or filter cancel an in-flight gesture like any other source change: edit-cancel with source-changed, also when a filter removes the dragged bar together with its row (hidden is reported only when the bar is still in bars but its row is not shown, for example under a collapsed parent). The CSS classes are vw-header-controls, vw-column-sort (vw-is-sorted), vw-column-title, vw-sort-indicator, vw-column-filter, vw-column-filter-popover, vw-column-filter-text, vw-column-filter-values and vw-column-filter-clear; they use the existing theme variables, so the dark themes apply, and the filter controls are hidden in print.
Dependency editing
| API | Behavior |
|---|---|
| connectable | Shows a link handle at the start and finish of every rendered bar. Drag from one handle to another handle or onto a bar body (the nearer end is used). Alternatively, activate two handles with click, tap, Enter or Space. |
| reconnectable | Select a dependency, then drag its source or target endpoint handle to another bar end, or activate the endpoint handle and then a bar handle. |
| validateConnection(connection, replacingDependencyId?) | Synchronous TimelineConnectionValidator. Accepts with true or undefined, rejects with false (default message "This dependency was rejected.") or a reason string. During reconnection it receives the existing dependency ID. |
| connect(connection) | TimelineConnection with from, to and type. The type is derived from the joined ends: finish→start is FS, start→start SS, finish→finish FF and start→finish SF. The parent assigns an ID and updates dependencies. A new connection never carries a lag. |
| reconnect(change) | TimelineReconnect with id, before and after connections. The parent replaces from, to and type on the existing dependency. A dependency with a non-zero lag keeps it: both connections then carry lag, and validateConnection receives the after connection with it. |
| connect-rejected(connection, reason) | Reports a rejected proposal. The reason is announced in the live region. |
| selectedDependencyId / update:selectedDependencyId | Optional controlled dependency selection. The component tracks the selection locally when the prop is omitted. |
| dependency-select(id) | A dependency path was activated by click, Enter or Space. Dependency paths are focusable only when connectable or reconnectable is set. |
| dependency-delete(id) | Delete or Backspace was pressed on a focused dependency. The parent removes it from dependencies to accept. Not emitted when readonly is set. |
A bar cannot link to itself, and reconnecting a dependency to its existing endpoints proposes nothing. Escape, pointer cancellation and loss of capture discard a pending connection. Changes to bars, rows, dependencies, the coordinate system or the connectable and reconnectable props cancel an in-flight connection, including one armed from the keyboard. Handles are hidden and no connect, reconnect or dependency-delete proposal is emitted when readonly is set; selecting a dependency (dependency-select) stays possible, like selecting a bar.
Related exported types: TimelineDependencyType.
Dependency lag
TimelineDependency.lag is optional: the elapsed time between the linked bar ends, in the units of range (milliseconds by default). A negative lag is a lead. The chart draws the dependency between the bar ends whatever the lag and does not enforce it; it is information for the reader, the export and your scheduler. A dependency without lag, or with lag: 0, gets no lag label and no lag description, in the chart and in renderTimelineSvg output, and its accessible name is the same either way.
| API | Behavior |
|---|---|
| TimelineDependency.lag | number, optional. A value that is not a finite number is reported through validation-error as a RangeError (validateTimelineData). |
| formatLag | (lag: number) => string, default formatDependencyLag: signed hours of a millisecond lag rounded to two decimals, such as +2 h, +0.5 h or −1.5 h (U+2212 minus sign). It is called only for a non-zero lag. Charts in other units, or that want days or local wording, pass their own formatter, as they do with formatTime. |
vw-gantt-lag | The label: an SVG text element in its own layer (vw-gantt-lag-layer, an aria-hidden SVG right after the dependency layer and stacked above the marker, now and status-date lines, so a line that crosses a label never covers its text; renderTimelineSvg likewise draws the labels after those lines), drawn in the gap at the edge of the source row that faces the target, beside the connector's first bend and towards later times; a link within one row is labelled above the connector. It uses --vw-text with a --vw-surface halo, and --vw-dependency-highlight (class vw-is-highlighted) for a dependency in highlightedDependencyIds. It is drawn whenever the connector is drawn and hidden with it (virtualized rows and time windows, collapsed rows). In a right-to-left chart the layer is mirrored as a whole and each label is turned back in place by its own transform attribute (a flip about its anchor, with a start anchor written as text-anchor="end"), so the text reads normally. |
| GanttLabels.lag | Description prefix, default "Lag". With connectable or reconnectable, the focusable dependency keeps its accessible name ("Select dependency Wireframes → Billing API FS") and is described by the label: "Lag +2 h". Without them the dependency layer is decorative, so the lag is not announced. |
| reconnect | Keeps the lag, see Dependency editing. |
exportSvg, exportPng and renderTimelineSvg (option formatLag) draw the same label. ScheduleLink extends TimelineDependency, so in a task chart (one bar per task, bar ID = task ID) the same dependency array can feed the chart and scheduleTasks, propagateEdit (and therefore a cascade callback) and rescheduleFromStatusDate, which all apply the lag; toMsProjectXml writes it as LinkLag. With epoch milliseconds the scheduler requires each lag to be a multiple of its quantum. A resource view built with projectResourceTimeline is different: its chart links connect bar IDs, so pass the task links to the projection and use its dependencies (see Resource timelines and unplanned tasks).
The chart does not edit lags. Change one through your own UI and replace the dependency, for example from the dependency selection or the context menu, whose events carry the dependency ID:
ts
function editLag(id: string, hours: number) {
dependencies.value = dependencies.value.map(dep => dep.id === id ? { ...dep, lag: hours * 3_600_000 } : dep)
}
// <GanttChart ... connectable @dependency-select="id => (editing = id)"
// context-menu @context-menu="menu => menu.target.kind === 'dependency' && (editing = menu.target.id)" />Dependencies on summary rows
A dependency normally joins two bars. With the opt-in summaryDependencies prop, TimelineDependency.from or to may instead be the ID of a summary row: a row that other rows name as parentId. An ID that is also a bar ID always means the bar. No type changes: scheduleTasks takes the same links when bar IDs, row IDs and task IDs agree (one bar per task, rowId: task.id), so a link to a summary task (see Summary tasks) feeds both unchanged. Without the prop a summary row end is an unknown endpoint, reported like any other ID that is not a bar, and the prop affects nothing but dependencies with a summary end.
| API | Behavior |
|---|---|
| summaryDependencies | boolean, default false. Validation (validateTimelineData with { summaryDependencies: true }) accepts a summary row ID as a dependency end; any other unknown ID still throws Unknown dependency endpoint, and a summary still cannot link to itself. As scheduleTasks does for summary tasks, a dependency between a summary row and a bar or summary row below it throws an Error (Dependency <id> links summary row <summary> with its own subtask <end>). |
| Anchor | A summary end is the rollup bar that showSummaries draws on the row: its start edge for the S of the type, its finish edge for the F (FS from a summary leaves its finish; FS into it enters its start), at the middle of the row. The rollup is summarizeTimelineRows over the descendant bars, so the line follows when they change. During a drag, the rollup bar and its links follow the previewed time ranges of the dragged bars (not a row change, and not cascade ghosts, which ordinary links do not follow either). |
| Hidden ends | A summary end is drawn only while its row draws a rollup bar: showSummaries is on, the row has descendant bars and has no bar of its own, and the row is displayed. Otherwise the dependency is hidden, like a dependency whose bar is in a collapsed group. A collapsed summary still draws its rollup bar and keeps its links; links to the bars it hides are hidden, like links into any collapsed group. Virtualized rows and the visible time window apply as for other links. |
| Styling and names | Connector styles (dependencyStyle), lag labels, highlightedDependencyIds (for example a plan's criticalDependencyIds), selection and right-to-left mirroring work as for other links. The accessible name uses the row label for the summary end, such as "Select dependency Design → Build phase FS"; selection, dependency-select, dependency-delete and reconnect handles work as for other links. |
| Editing | With connectable (or while reconnecting), each displayed rollup bar gets link handles at its start and finish, named like bar handles with the row label ("Start dependency from finish of Build phase"), and a link dragged onto a rollup bar joins its nearer end. connect and reconnect then carry the summary row ID. The chart stays controlled and does not check the type: scheduleTasks throws for FF and SF links into a summary task, so reject them in validateConnection, together with links between a summary and a bar or row below it, which the chart's validation rejects as well. An armed connection that starts at a rollup bar reports the summary row ID in edit-cancel barIds. |
| Export | exportSvg, exportPng and renderTimelineSvg (option summaryDependencies, with showSummaries) draw the same links. |
ts
const summaries = new Set(rows.flatMap(row => row.parentId === undefined ? [] : [row.parentId]))
function validateConnection(connection: TimelineConnection) {
if (summaries.has(connection.to) && (connection.type === 'FF' || connection.type === 'SF')) {
return 'Link to the subtask that should finish instead.'
}
}
// <GanttChart :rows="rows" :bars="bars" :dependencies="links" show-summaries summary-dependencies connectable
// :validate-connection="validateConnection" @connect="addLink" />timelineFromMsProject(project, { summaryDependencies: true }) keeps links that touch a summary task in dependencies instead of hiddenDependencyIds.
Multiple selection, batch moves and row moves
| API | Behavior |
|---|---|
| multiSelect | With selectedIds, a click emits update:selectedIds. Ctrl, Meta or Shift toggles membership; a plain click replaces the set. The select event still fires once per click. A click that ends a drag does not change the selection. |
| edits(changes) | Moving a selected bar by pointer or arrow key moves every selected editable bar by the same snapped displacement. The displacement is clamped so all intervals stay inside editBounds. Several changes are emitted once as TimelineEdit[]; a single change uses edit. Resizing applies only to the bar being handled. |
| validateEdits(changes) / edits-rejected(changes, reason) | Synchronous BatchEditValidator for the whole batch. Without it, each change runs through validateEdit and the first rejection rejects the batch. |
| rowDraggable | A move drag also proposes the displayed row under the pointer, and Up/Down arrows move a focused editable bar to the adjacent displayed row. The proposal carries row: { before, after }. Selected bars move rows together and stop at the first or last row. Rows hidden by a collapsed parent are not targets. |
The application accepts a row move by replacing the bar's rowId with change.row.after. Validate row changes in validateEdit or validateEdits, for example to keep work on a compatible resource. During a pointer row drag the bar is previewed with a vertical offset and stays in its source row element; the preview is discarded on cancellation like any other edit. After an accepted keyboard row move the chart scrolls the row into view and restores focus to the moved bar. GanttLabels.moveRowHint (default "Up and Down arrows move the bar to another row.") is added to the bar description when rowDraggable is set.
Zoom presets, now marker and touch zoom
| API | Behavior |
|---|---|
| zoomPresets | TimelineZoomPreset[] with unique id, label, pixelsPerUnit and optional tickSteps, headerBands and snap. Renders a labelled button group (GanttLabels.zoomPresets, default "Zoom level"). The active preset replaces the corresponding props; omitted fields fall back to them. |
| zoomPreset / update:zoomPreset | Optional controlled preset ID. An unknown ID is reported through validation-error. Choosing a preset resets the zoom factor to 100% and keeps the centered time in view. |
| zoom-change(state) | TimelineZoomState with zoom factor and the active preset ID. Fires for zoom buttons, presets, pinch zoom and wheel zoom. |
| showNow / now | Draws a "now" marker (GanttLabels.now). Supply now for deterministic and server-rendered output. Without now, the clock is read only after mounting and refreshed every 30 seconds, so server and client markup match. The marker appears only inside range. |
| pinchZoom | Two touch pointers on the timeline zoom the time axis around their midpoint, between 65% and 300%. The second touch cancels an in-flight edit or connection. One-finger touches and mouse input are unchanged. The scroll area uses touch-action: pan-x pan-y so native scrolling continues while the browser's page zoom is suppressed there. |
| wheelZoom | boolean, default false. Ctrl+wheel or Meta+wheel over the chart zooms the time axis between 65% and 300%, keeping the time under the pointer in place (the pointer is clamped to the visible time area). Desktop trackpad pinches arrive as Ctrl+wheel and zoom the same way. Each event scales the zoom by 1.35^(−deltaY / 100) in pixels (lines count 16 px), clamped to one zoom button step, so one mouse wheel notch equals one button step and small trackpad deltas zoom smoothly. The event is cancelled so the browser does not zoom the page, also at the limits. Like the second touch of a pinch, it cancels an in-flight gesture or armed connection without a proposal, and it hides the tooltip. A plain wheel is never handled and keeps native scrolling. The non-passive wheel listener is attached after mounting only while the prop is set and removed when it is cleared or the chart unmounts; without the prop nothing changes. |
Presets apply to the built-in linear scale. A custom scale prop still controls the mapping; only tick steps, header bands and snap come from the preset in that case. Use calendarBands from the core entry to build header levels for presets; pass its timeZone option to keep them on local midnights and hours across daylight-saving transitions. For ready-made day, week, month and quarter views, see Calendar zoom presets and locale-aware labels.
Calendar zoom presets and locale-aware labels
Three core helpers save hand-composing calendar views in epoch milliseconds. They use Intl.DateTimeFormat, which Node, workers and browsers provide, with cached formatters. They never use the runtime's default locale or time zone (the defaults are en-US and UTC), so server and client render the same labels for the same options; the text still depends on the runtime's Intl (ICU) data, which can differ in details such as a comma after a weekday. The component's default formatTime (UTC HH:mm) does not change.
| Export | Behavior |
|---|---|
| calendarZoomPresets(range, options?) | CalendarZoomPreset[], ready for zoomPresets: one complete TimelineZoomPreset per level (id is the level) with pixelsPerUnit, ascending tickSteps, snap and headerBands built with calendarBands for range, plus a formatTime for that level. See below |
| intlTimeFormatter(options?) | A formatTime-compatible (time: number) => string from IntlTimeFormatterOptions: locale (string or list, default en-US), timeZone (IANA, default UTC) or utcOffsetMinutes (integer from -1080 to 1080, not both), and format (Intl.DateTimeFormatOptions, default { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }, so the defaults give the same 09:00 text as the component default). A timeZone inside format is ignored. Thin, narrow no-break and no-break spaces (U+2009, U+202F, U+00A0), which ICU versions write differently, come out as plain spaces, so server and browser render the same text. An invalid zone, offset or locale throws RangeError when the formatter is created, and a non-finite time when it is called |
| calendarBands(range, unit, { locale, labelFormat }) | Locale-aware band labels: with locale or labelFormat, each label is the band start's local date and time (in timeZone or utcOffsetMinutes) formatted with Intl.DateTimeFormat. labelFormat defaults by unit: hour { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }, day and week { year: 'numeric', month: 'short', day: 'numeric' }, month { year: 'numeric', month: 'long' }, year { year: 'numeric' }; locale defaults to en-US. A label function wins over both. Without them, labels stay ISO-like |
CalendarZoomPresetOptions are locale, timeZone or utcOffsetMinutes (as for intlTimeFormatter), weekStartsOn (0 Sunday to 6 Saturday, default 1, for week bands), levels (a subset of CalendarZoomLevel in the order of the buttons, default all six) and labels (button text by level; defaults Hours, Days, Weeks, Months, Quarters, Years). levels that is not an array or names an unknown level throws RangeError and a repeated level Error; an invalid range, zone or offset throws RangeError. Each call returns fresh arrays (tickSteps, headerBands), so changing a returned preset does not affect later calls.
| Level | pixelsPerUnit | tickSteps | snap | headerBands | formatTime |
|---|---|---|---|---|---|
| hours | 60 px per hour | 15 min to 12 h | 15 min | days (Sun, Mar 1, 2026) | 09:00 |
| days | 80 px per day | 1, 2, 7 days | 1 h | months (March 2026) | Sun, Mar 1 |
| weeks | 16 px per day | 7, 14, 28 days | 1 day | months, weeks (Mar 2) | Mar 1 |
| months | 4 px per day | 7 to 56 days | 1 day | years, months (Mar) | Mar 1 |
| quarters | 1.5 px per day | 28, 56, 91 days | 1 day | years, quarters (Q1) | Mar 1 |
| years | 0.4 px per day | 91, 182, 364 days | 1 day | years | Mar 1, 2026 |
The examples are en-US. The date formatTime of the day and coarser levels appends the local time when an instant is not local midnight (Mar 1 13:30), so bar names stay exact. GanttChart does not read formatTime from a preset: pass the active preset's formatTime as the chart's formatTime. Header bands follow local dates in the zone, so a month band across a daylight-saving change starts and ends at local midnight. Ticks stay uniform elapsed-time steps counted from range.start, as the chart draws them: start the range on a band boundary (a local midnight or week start) to align them, and expect a daily tick to sit an hour off local midnight after a daylight-saving change, where its label shows the time. The presets cover range only; build new ones when it changes.
vue
<script setup lang="ts">
import { computed, ref } from 'vue'
import { GanttChart, calendarZoomPresets } from '@eightkk/vue-weave'
const range = { start: Date.parse('2026-04-06T00:00:00+02:00'), end: Date.parse('2026-08-31T00:00:00+02:00') }
const presets = calendarZoomPresets(range, { locale: 'de-DE', timeZone: 'Europe/Berlin', levels: ['days', 'weeks', 'months'] })
const level = ref('weeks')
const active = computed(() => presets.find(preset => preset.id === level.value)!)
</script>
<template>
<GanttChart :rows="rows" :bars="bars" :range="range" :zoom-presets="presets" :zoom-preset="level"
:format-time="active.formatTime" @update:zoom-preset="level = $event" />
</template>Related exported types: CalendarBandOptions, CalendarBandUnit.
Marker ranges
markerRanges highlights half-open intervals [start, end) such as a code freeze, holidays or an office closure. It is opt-in: without it (or with an empty array) the chart renders exactly the markup it did before. Point markers (markers) are unchanged; a marker range is a separate TimelineMarkerRange with id, start, end, label, optional tone and optional rowIds.
| Field | Behavior |
|---|---|
| id | Unique among the marker ranges. Missing or duplicate: Error through validation-error |
| start, end | Finite numbers in the units of range, with start < end; otherwise RangeError through validation-error. A zero-width range is rejected: use a TimelineMarker for a point in time |
| label | Text of the header label and the start of its accessible name |
| tone | ChartTone (teal, blue, amber, violet): the band and label use the tone's pale, line and ink colours. Without it they use --vw-range, --vw-range-line and --vw-range-ink |
| rowIds | Restricts the band to these rows (each must be a row ID; unknown IDs are an Error through validation-error). Rows hidden by a collapsed parent, and rows outside the virtual row window, draw no band; the header label is always drawn. Without it the band covers the full body height, including load rows |
Each range draws a band (vw-gantt-range, plus vw-is-row for a row band and vw-tone-<tone> vw-has-tone with a tone) below the bars, markers and the now line, at --vw-range-opacity (default 0.7), and a 13 px label strip at the bottom of the time header (vw-gantt-range-label), above the tick lines. Only the part inside range and the visible time window is rendered, so ranges are virtualized with the other items. The band is decorative (aria-hidden); the label has role="img" and the accessible name and title <label> <formatTime(start)>–<formatTime(end)>, like the status-date marker, from the unclipped endpoints. Positions are measured from the inline-start edge, so ranges are mirrored in right-to-left charts. Ranges may overlap; later ones are drawn on top. exportSvg, exportPng and renderTimelineSvg (markerRanges option) draw the same bands and labels with <title> elements, and printing keeps them.
Resource load histogram
| API | Behavior |
|---|---|
| loadRows | TimelineLoadRow[] with unique id, label and optional detail. Each row is drawn below the task rows on the same time axis, scroll surface and horizontal virtualization. |
| loadSegments | TimelineLoadSegment[]: resourceId, start, end, load, capacity, optional overload and taskIds. The output of calculateResourceLoad can be passed directly. Segments must reference a load row and must not overlap within a resource. |
| loadRowHeight | number / 44. At least 16. |
| load-row slot | Customize the label using row and peak. |
| load-segment slot | Customize a segment using segment, row, peak and overload. The slot content is inside an element with role img and an accessible label. |
Each segment is scaled to the row's peak load or capacity. The default rendering fills load up to capacity, highlights the overloaded part and draws a dashed capacity line. Segments carry an accessible label such as "CNC cell 09:00–10:00: load 2 / capacity 1, overloaded by 1", built from formatTime and the GanttLabels fields load, capacity and overload; the load row group is named with loadRegion. Invalid load data is reported through validation-error. With loadSelectable, each segment is a focusable element with role button (class vw-is-selectable) and the same accessible name, and highlightedLoadTargets and selectedLoadTargets mark segments by time range; see Linked views, reveal and external drops.
Related exported types: ResourceLoadHistogram.
Linked views, reveal and external drops
These additions connect the chart to other views (for example through useLinkedSelection) and to external lists. All are opt-in; without them the markup, accessible names and events are unchanged.
| API | Behavior |
|---|---|
| highlightedBarIds | Bars drawn with vw-is-highlighted (an outline in --vw-bar-highlight). Display only: they are not part of the selection, so Delete and multiple-selection moves never include them, they do not mark dependencies (use highlightedDependencyIds) and a change does not cancel a gesture. Like other bars, a highlighted bar outside the visible window is not rendered; use revealBar to move to it. exportSvg and exportPng pass the set to renderTimelineSvg. |
| target-enter(event), target-leave(event), target-activate(event) | ViewTargetEvent { target, source }, with target a ViewTarget and source 'pointer' or 'keyboard'. Bars report { view: 'timeline', kind: 'bar', id }: enter and leave on pointer hover and on visible keyboard focus and blur, activate on click, Enter or Space (not after a drag), next to the existing select. Dependencies report kind: 'dependency' in the same way where they are focusable (connectable or reconnectable). Rows report kind: 'row': enter and leave on hover of the row and on visible focus of its heading text or of controls in its heading, activate on a click of the heading text or Enter or Space on it (source keyboard). The heading text (vw-row-content, the default markup or the row slot) is a role="button" element named by its content and focusable through one roving tab stop for the whole heading column: only one heading has tabindex="0" (the one focused last while it is rendered, else the first rendered row), the others -1. On a focused heading, ArrowUp and ArrowDown move to the previous and next displayed row, Home and End to the first and last, scrolling the row into view. Keys pressed on controls inside a row slot are left to those controls, and the expand toggle, add button and move handle keep their own keys and tab stops. With loadSelectable, load segments report { view: 'load', resourceId, start, end } on hover, focus, click, Enter and Space. Hover never scrolls. The existing payload unions such as TimelineContextTarget are unchanged. |
| background-click(click) | TimelineBackgroundClick { time, rowId? }. Fires when a primary-button press on an empty part of the time area (the background of a row, or the empty space below the rows, where rowId is absent; not a scroll bar) is released before it moves past the drag threshold. time is the unsnapped time under the pointer. It does not fire for bars, dependencies, handles, markers, the heading column, the header or the load rows, nor in rows where creatable lets the click propose a bar. The component keeps no selection of its own, so an application usually clears its controlled selectedIds here. |
| idle-escape(event) | KeyboardEvent. Declared as the listener prop onIdleEscape rather than an emit: GanttChart has as many emits as vue-tsc can turn into typed listener props, and one more would type them all as any in the declarations. It is still delivered as a component event, so @idle-escape (with .once) works in templates and onIdleEscape (or onIdleEscapeOnce) in render functions. Fires when Escape is pressed inside the chart and cancels nothing of the chart's own: no drag, armed connection or open cell editor was cancelled (no edit-cancel for it; an Escape anywhere in the chart, including its zoom and preset buttons and the legend slot, first cancels them), the key was not pressed in a text field, select or editable content, not handled by a filter dialog or a spreadsheet range (which keep their Escape) and not part of an input method composition, and no handler inside called preventDefault. Dismissing the tooltip does not count as cancelling. Opt-in, like background-click: an application usually clears its controlled selectedIds here, so the first Escape cancels an edit and the next one clears the selection, without tracking edit-cancel itself. |
| loadSelectable | boolean / false. Segments become focusable (tabindex="0", role button) with an outline in --vw-load-focus on focus. Segments outside the virtualized window are not rendered; resolve a stored load target against the current segments with resolveLoadTargets. |
| highlightedLoadTargets / selectedLoadTargets | readonly LoadViewTarget[] / undefined. Load segments have no ID and their boundaries move when load is recalculated, so these props take resource time ranges ({ view: 'load', resourceId, start, end }, for example useLinkedSelection().load.value.highlighted and .selected) and mark every current segment of that resource whose half-open range overlaps one (the rule of resolveLoadTargets). Matching segments get vw-is-highlighted (an inset ring in --vw-load-highlight) or vw-is-selected (--vw-load-selected); with loadSelectable and selectedLoadTargets set, segment buttons also carry aria-pressed. Display only: the chart never changes them, they work with or without loadSelectable, and the accessible names stay the same. A target that is not a valid load target throws like resolveLoadTargets. |
| revealBar(id, options?) | Exposed method returning Promise<RevealResult>. An unknown ID resolves { status: 'unknown' } and a bar whose row is hidden by a collapsed ancestor resolves { status: 'hidden-by-collapse', proxyId } with the nearest displayed ancestor row; neither throws or scrolls. Otherwise the chart scrolls the bar's row and interval into view, waits for the next render (nextTick) so the virtualized bar exists, then moves DOM focus to it when options.focus is true, and resolves { status: 'revealed' }. Expanding collapsed rows is the parent's decision: update collapsedIds, then call revealBar again, or use revealLinkedTarget (see Linked views). After an accepted row change that gives a bar a new ID (for example a resource projection), call revealBar(newId, { focus: true }). |
| droppable / bar-drop(event) | With droppable, the chart accepts HTML drag and drop (it calls preventDefault on dragenter, dragover and drop) and emits TimelineDrop with time (snapped to the active snap and kept inside range), rowId (the displayed task row under the point; absent over the header and load rows), clientX, clientY and dataTransfer. The chart neither reads the data nor adds anything: the parent resolves what was dropped, for example from an ID in the data, and proposes it. TimelineDrop is exported from the Vue entry only. |
RevealOptions also has scale, which only graph reveals use. ViewTargetEvent, RevealStatus, RevealOptions and RevealResult are exported from both entries.
Calendar shading, critical path, float and segments
All of these are opt-in. Without nonWorkingPeriods and the new bar fields, the chart renders no new elements, classes or attributes, and accessible names and descriptions are unchanged.
| API | Behavior |
|---|---|
| nonWorkingPeriods | Half-open intervals drawn as background bands (vw-gantt-non-working, colour --vw-non-working) over the full body height, task rows and load rows, behind grid lines and bars. Only the parts inside range and the visible time window are rendered. Intervals may overlap and need not be sorted. A non-finite endpoint or start >= end is reported through validation-error. The bands are decorative (aria-hidden). invertWorkPeriods turns work periods into these intervals. |
| TimelineBar.critical | true adds the vw-critical class and an outline in --vw-critical. |
| TimelineBar.description | Extra text about the bar for screen readers and the native tooltip, for example "Manually scheduled" or "Inactive". It comes first in the bar's accessible description (a trailing full stop is dropped, as the parts are joined with ". "), before the critical, float, deadline, constraint and baseline facts, and after the dates in the bar's title; exportSvg and renderTimelineSvg add it to the bar's <title>. The accessible name is unchanged. Must be a string (Error otherwise); blank text is ignored. |
| TimelineBar.latestEnd | Latest finish that keeps the plan. A float line (vw-gantt-float, --vw-float) runs from the bar's end to latestEnd at the bar's vertical centre, ending in a short tick. Nothing is drawn when latestEnd equals end. Must be finite and not before end (RangeError). |
| TimelineBar.deadline | A due time. A small indicator (vw-gantt-deadline, --vw-deadline) is drawn at that time in the bar's lane. When end is after the deadline, the bar gets the vw-late class and a dashed outline, and the indicator gets vw-late. Must be finite (RangeError). |
| TimelineBar.segments | The worked pieces of a split bar: sorted, non-overlapping, positive-length intervals inside [start, end]. Touching pieces are allowed. The bar gets the vw-segmented class, each piece is drawn solid (vw-gantt-segment) and every gap, including one before the first or after the last piece, is drawn as a thin connector (vw-gantt-segment-gap). Progress fills the first part of the working time piece by piece, so a half-complete bar fills half of its work. An empty array or segments on a milestone are rejected with a RangeError. |
| GanttLabels.critical / float / deadline / late | Text of the bar description. Defaults "Critical", "Float until", "Deadline" and "Late". |
When a bar has any of these fields, the information is added to the bar's accessible description, never to its accessible name, which keeps the formatTime label used by tests and assistive technology. The description reads, for example, "Critical. Float until 09 Nov 16:00. Deadline 09 Nov 17:00. Late." (float and deadline times use formatTime). It is a hidden element referenced first in aria-describedby, before the edit hint of an editable bar, and it is also appended to the bar's title tooltip.
Float lines and deadline indicators are rendered whenever they intersect the visible time window, even if their bar is outside it, and follow the bar in a pointer preview: the float line starts at the previewed end and the late state uses the previewed end. Edit proposals (TimelineEdit) are unchanged and carry only start and end. During a pointer move preview the segments shift with the bar by the same displacement. During a resize preview the bar is drawn without segments, because the new work pattern depends on the calendar: the parent reschedules after accepting the edit and supplies new segments, latestEnd and critical values. Keyboard edits are proposed at once without a preview.
ts
import { invertWorkPeriods, scheduleTasks, scheduledBarFields } from '@eightkk/vue-weave/core'
const plan = scheduleTasks({ range, calendars: [{ id: 'plant', periods }], defaultCalendarId: 'plant', tasks, dependencies })
const bars = plan.ok ? plan.tasks.map(task => ({ id: task.id, rowId: task.id, label: task.id, ...scheduledBarFields(task) })) : []
const nonWorkingPeriods = invertWorkPeriods(periods, range)exportSvg, exportPng and renderTimelineSvg draw the same layers with the colours of --vw-non-working, --vw-critical, --vw-float and --vw-deadline. In a right-to-left chart every layer is mirrored with the time axis.
Progress editing, deletion, tooltips, context menu and fit
All of these are opt-in. Without progressEditable, deletable, contextMenu and the tooltip slot, the chart renders none of their markup, and keys, pointer behaviour, names and descriptions are not affected by them.
| API | Behavior |
|---|---|
| progressEditable | boolean / false. Draws a progress slider at the progress boundary of every editable, non-milestone bar (undefined progress counts as 0) unless readonly is set. Editing does not depend on editBounds. |
| progressStep | number / 0.05. Every proposal is snapped to this step; exactly 0 and 1 are always reachable. Must be greater than 0 and at most 1, otherwise a RangeError is reported through validation-error. |
| progress-edit(change) | TimelineProgressEdit with id, before (the bar's progress, possibly undefined), after (0 to 1) and source (pointer or keyboard). The parent sets the bar's progress to after to accept. A change that keeps the drawn value (after === (before ?? 0)) is not proposed. TimelineEdit is unchanged. |
| validateProgressEdit / progress-edit-rejected(change, reason) | Synchronous ProgressEditValidator with the same convention as validateEdit. The reason is announced in the live region. |
| deletable | boolean / false. Delete or Backspace on a focused deletable bar proposes removing it. A bar is deletable when the prop is set, the chart is not readonly and TimelineBar.deletable ?? TimelineBar.editable is true. Deletable bars are described by GanttLabels.deleteHint. |
| bars-delete(ids) | Emitted once per key press. With multiSelect, when the focused bar is selected, ids lists every selected deletable bar in input order; otherwise only the focused bar. Nothing is emitted during an edit or progress drag, a pending connection (including one armed from the keyboard) or a pinch. Use removeTimelineBars to accept. dependency-delete is unchanged. |
| validateBarsDelete / bars-delete-rejected(ids, reason) | Synchronous BarsDeleteValidator; true or undefined accepts, false (default message GanttLabels.rejected) or a string rejects. The reason is announced in the live region. |
| tooltip slot | { bar, range, selected }, where range is the displayed interval (the preview while one is shown). Rendered only when the slot is provided, never on the server or before mounting. While the slot is provided, bars omit their native title, so the browser does not show a second tooltip; the accessible name and description are unchanged. |
| tooltipDelay | number / 400. Milliseconds before a hover shows the tooltip. Finite and nonnegative, otherwise a RangeError is reported through validation-error. |
| contextMenu | boolean / false. Handles contextmenu on the chart region (default prevented) and the ContextMenu key and Shift+F10 on a focused bar, progress slider, constraint handle or dependency path. |
| context-menu(event) | TimelineContextMenu: target ({ kind: 'bar', id }, { kind: 'dependency', id }, { kind: 'row', id } or { kind: 'chart' }), time?, rowId?, clientX, clientY and source. The component renders no menu. |
| fitToBars(ids?, options?) | Exposed method. Zooms so the union interval of the bars fits, then scrolls it into view. Returns a promise that resolves once the scroll position is applied. |
The progress slider is a button with role="slider", aria-valuemin 0, aria-valuemax 100, aria-valuenow in percent and aria-valuetext such as "40%". Its accessible name is GanttLabels.progressOf (default "Progress of") followed by the bar label. Dragging it previews the fill and proposes the snapped value on release. On a segmented bar the pointer is mapped to progress over working time, as the fill is drawn: the slider sits where that share of the work is done, and a pointer in a gap counts the work before the gap. ArrowRight and ArrowUp add one step, ArrowLeft and ArrowDown subtract one, PageUp and PageDown change it by 0.25, Home sets 0 and End sets 1. Each key press proposes one change from the bar's current progress. In a right-to-left chart progress grows towards the left, so ArrowLeft adds a step and ArrowRight subtracts one. Escape, pointer cancellation, lost capture, changes to bars, rows, the coordinate system, progressEditable, progressStep or readonly, and the start of a pinchZoom pinch cancel the preview without a proposal.
After an accepted deletion removes the focused bar, focus moves to the chart region. The tooltip appears next to the hovered bar after tooltipDelay, or at once when a bar receives keyboard focus (:focus-visible). It has role="tooltip" and an ID from useId(), which is appended to the bar's aria-describedby list after the existing description and hint IDs while it is shown. It is placed above the visible part of the bar, or below it when there is no room, and kept inside the scroll viewport. The pointer can move onto it without hiding it. Escape hides it until the pointer re-enters the bar or the bar is focused again. Pressing a bar hides it, and it does not appear during bar drags and resizes, progress drags, pending connections, pinches or drag autoscroll. Its timers are cleared when the component unmounts. Style it with the vw-gantt-tooltip class.
For a pointer contextmenu, target is the bar under the pointer (including its link handles, progress slider and constraint handles), else the dependency path (dependency paths are interactive only with connectable or reconnectable), else the displayed task row under the pointer (its heading, cells or empty timeline area), else chart (the header, load rows or empty space). rowId is that task row, and time is the time under the pointer through the active scale, including zoom and right-to-left layout, whenever the pointer is over the time area (not the sticky heading column). Text inputs in columns keep the browser menu. The ContextMenu key and Shift+F10 report the focused element's on-screen centre, source: 'keyboard', no time, and for a bar its rowId. Without contextMenu the browser menu is not affected. With or without contextMenu, a contextmenu event during a pointer gesture (move, resize, progress, connection, create, row or column drag, or a pinch), such as a macOS Control-click, cancels the gesture without a proposal like cancelEdit(), because the native menu can swallow pointerup; an armed keyboard connection is kept. The same holds for a constraint drag. With contextMenu the menu is then reported as usual.
fitToBars(ids?: Iterable<string>, options?: TimelineFitOptions) uses every bar in the displayed rows when ids is omitted; explicit IDs may also name bars in collapsed rows. It chooses the zoom factor so that the union of the bars' intervals spans the visible time area minus padding screen pixels on each side (default 24), clamped to the zoom limits (65% to 300%), then scrolls the union to the centre when it fits, or to padding from the inline-start edge when it does not. Scrolling stops at the ends of the axis, so a union that touches range.start or range.end sits at that edge. Unknown IDs throw an Error and a negative or non-finite padding throws a RangeError, synchronously; an empty set does nothing. The zoom factor scales the base scale linearly, so the fit is exact for a custom scale, including a non-linear one. With zoomPresets the active preset is kept and only the zoom factor changes, so the fit is limited to 65%–300% of the preset's scale. zoom-change is emitted when the factor changes. A union of milestones at one time keeps the zoom and is centred. Pointer gestures in progress are cancelled.
Drag to create and cascade previews
Both are opt-in. Without creatable and cascade, the chart renders none of their markup, and pointer, keyboard, events, names and descriptions are not affected by them.
| API | Behavior |
|---|---|
| creatable | boolean or (row: TimelineRow) => boolean, default false. Enables creation in every displayed row, or in the rows for which the predicate returns true. Nothing is created when readonly is set. |
| createDuration | number / 4 × snap (one hour with the default snap). Length of a bar proposed by a click or the add button. Finite and positive, otherwise a RangeError is reported through validation-error. |
| create(proposal) | TimelineCreate with rowId, lane, start, end and source (pointer or keyboard). The parent assigns an ID and a label and adds the bar to accept it. |
| validateCreate / create-rejected(proposal, reason) | Synchronous CreateValidator with the same convention as validateEdit; false uses GanttLabels.createRejected (default "This new bar was rejected."). The reason is announced in the live region. |
| cascade | TimelineCascade: (change: TimelineEdit) => readonly TimelineEdit[], synchronous and free of side effects. Returns the follow-on changes of other bars, for example from propagateEdit. A change of dependencies during a cascading bar drag cancels the drag without a proposal, because its previewed follow-on changes came from the old dependencies. |
vw-gantt-create-preview, vw-gantt-cascade-preview | Classes of the previews. The create preview uses --vw-accent and cascade previews use --vw-cascade. Both are aria-hidden and ignore the pointer. |
Pointer. Press the primary button (or touch) on the empty timeline area of a creatable row and drag. The empty area is the row background: not a bar, handle, progress slider, dependency path, baseline or summary, and not the row heading or its cells. The preview runs from the press time to the time under the pointer, both rounded to the nearest multiple of snap from range.start. It is at least minDuration long (growing away from the press point) and is kept inside editBounds. It stays in the pressed row and sits in the lane under the pointer, clamped to the row's lanes. Release proposes the previewed interval with source: 'pointer'. A click, or a movement of less than 3 px along the time axis, proposes [t, t + createDuration) from the snapped press time t, moved back inside editBounds when it would end after them, in the lane under the pointer. A drag near the left or right edge scrolls the timeline (autoScroll). The time follows the active scale, zoom and right-to-left layout: in RTL, dragging to the left extends the bar to later times.
Escape, pointer cancellation (including a native touch pan), lost capture and changes to bars, rows, the coordinate system, readonly, createDuration or the other props that cancel edits discard the preview without a proposal, and so does the second touch of a pinchZoom pinch. Zoom buttons and presets are ignored during the drag. A press does not start a create gesture while another gesture is active. Pressing a row focuses the chart region, so Escape works at once. Tooltips are hidden during the drag.
Keyboard. Every creatable row gets an add button (vw-gantt-create-button) in its heading, named GanttLabels.createIn (default "Add bar to") followed by the row label, for example "Add bar to Web team". Activating it with Enter or Space proposes createDuration from the first multiple of snap at or after the time at the inline-start edge of the visible time area, moved inside editBounds. The lane is the lowest lane of the row without an overlapping bar (lane 0 when every lane is taken) and source is keyboard (a mouse click on the button reports pointer). Focus stays on the button. The row's expand toggle keeps its place before the button.
Cascade. During a pointer move or resize, the chart calls cascade with the primary TimelineEdit (source pointer) whenever the snapped previewed interval or row changes, never on every pointer movement. Each returned change is drawn as a dashed outline at its after interval, in the lane of its bar and in the row of change.row?.after (or the bar's own row). The bars, their names and the dependency paths keep their current positions until the parent applies the result. Keyboard moves, resizes and row moves call it once per key press, without a preview. When the release or key press proposes the edit, the primary change comes first and the cascaded changes follow. All of them are emitted once through edits and checked like a batch: by validateEdits, or else by validateEdit for each change, where the first rejection rejects the batch through edits-rejected. When the callback returns no change, the chart emits a single edit, as it does without cascade.
Returned changes for unknown bar IDs and for the bar being edited (or any bar of a multiple-selection move) are ignored, and so are changes whose after interval and row equal the bar's current ones. For a multiple-selection move the callback is called once per moved bar and the results are merged; when several calls return a change for the same bar, the last one wins. An after interval with a non-finite endpoint or end < start is an error. When the callback throws or returns such an interval, no preview is drawn and the edit is rejected with the error message: edit-rejected for a single bar, edits-rejected for a multiple-selection move. Keep cascade cheap and synchronous, and return [] when no schedule can be computed.
ts
import { propagateEdit, type TimelineEdit } from '@eightkk/vue-weave/core'
function cascade(change: TimelineEdit): TimelineEdit[] {
if (change.mode !== 'move') return []
const result = propagateEdit(scheduleInput, { id: change.id, start: change.after.start })
return result.ok ? result.changes.filter(item => item.id !== change.id)
.map(item => ({ id: item.id, before: item.before, after: item.after, mode: 'move', source: change.source })) : []
}Use assignLanes(bars, { keepLanes: true }) (below) to stack new bars that overlap others in one row, and pass its laneCount with a rowHeight of at least 8 + laneCount × 14.
Row hierarchy moves, status date and progress line
All of these are opt-in. Without rowsReorderable and statusDate, the chart renders none of their markup, and pointer, keyboard, events, names and descriptions are not affected by them. showProgressLine has no effect without statusDate.
| API | Behavior |
|---|---|
| rowsReorderable | boolean, default false. Each displayed row heading gets a move handle (vw-row-move-handle, a button before the expand toggle and the add button) named GanttLabels.moveRow (default "Move row") followed by the row label, for example "Move row Web team", and described by GanttLabels.moveRowKeysHint. No handles are drawn when readonly is set. |
| row-move(change) | TimelineRowMove: id, before and after (TimelineRowPosition: optional parentId, absent for a root row, and the zero-based index among that parent's children) and source (pointer or keyboard). after.index counts the new siblings without the moved row. Accept it with moveTimelineRow(rows, change.id, change.after). A move to the current position is not proposed. |
| validateRowMove / row-move-rejected(change, reason) | Synchronous RowMoveValidator. Accepts with true or undefined, rejects with false (default GanttLabels.rowMoveRejected, "This row move was rejected.") or a reason string. The reason is announced in the live region. |
| statusDate | number, in the units of range. Draws a vertical line (vw-gantt-marker vw-gantt-status-date, colour --vw-status) labelled GanttLabels.statusDate (default "Status date"). The line has role="img" and the accessible name and title "Status date" followed by formatTime(statusDate). It is drawn only inside range and the visible time window. A non-finite value is reported through validation-error. |
| showProgressLine | boolean, default false. With statusDate, draws a progress line (vw-gantt-progress-line, --vw-status) down the rendered rows. It runs along the status date and kinks to the progress point of each bar that is behind or ahead: a bar that started before the status date and is not complete, or that ends after it and has progress. The progress point is start + progress × duration, or the time at which that share of the work is done for a segmented bar. Milestones, complete bars before the status date and unstarted bars without progress keep the line straight. The line is decorative (aria-hidden) and follows previews of moves and progress drags. |
Keyboard. On a focused move handle, Alt+ArrowUp and Alt+ArrowDown move the row one place among its siblings (nothing is proposed at either end). Alt+Shift+ArrowRight indents the row: it becomes the last child of its previous sibling. Alt+Shift+ArrowLeft outdents it: it becomes the next sibling after its parent. In right-to-left charts the two directions are swapped, so the arrow towards the row text indents, and the default hint says so. A first sibling cannot be indented and a root row cannot be outdented. After the parent applies the move, the chart scrolls the row into view and returns focus to its handle.
Pointer. Press the primary button (or touch) on a move handle and drag vertically. A drop indicator (vw-gantt-row-drop, --vw-accent, aria-hidden) shows the position: the upper half of a displayed row places the moved row before it, the lower half after it, which is its first child when the row's children are shown. Positions inside the moved row's subtree are not offered. Release proposes the indicated position with source: 'pointer'. Escape, pointer cancellation, lost capture, a source change (rows, collapsed rows, rowsReorderable and the other props listed in the editing contract) and a second pinch touch cancel the drag without a proposal.
ts
import { moveTimelineRow, timelineWbsCodes, type TimelineRowMove } from '@eightkk/vue-weave/core'
function onRowMove(change: TimelineRowMove) {
rows.value = moveTimelineRow(rows.value, change.id, change.after)
}
const wbs = computed(() => timelineWbsCodes(rows.value)) // for a WBS columnexportSvg includes the status-date line and, with showProgressLine, the progress line; pass includeStatusDate: false in GanttExportOptions to leave both out.
Scheduling constraints
Opt-in. A chart whose bars have no constraints (or an empty object), without constraintsEditable, renders no constraint markup, and keys, pointer behaviour, events, names and descriptions are not affected by constraints. constraintsEditable without constraints adds only a hidden hint element.
| API | Behavior |
|---|---|
| TimelineBar.constraints | TimelineConstraints: optional startNoEarlierThan, startNoLaterThan, finishNoEarlierThan, finishNoLaterThan and fixedStart, each a time in the units of range. The names are those of ScheduleTask, so { id, duration, ...bar.constraints } is a valid task. A value that is not a finite number is a RangeError (Constraint startNoEarlierThan of bar a must be a finite time) and a constraints value that is not an object an Error, both reported through validation-error. Combinations that cannot all be met are allowed: whether they are feasible is decided by scheduleTasks. Other fields of the object are ignored. |
| fixedStart | A required start, independent of the bar's own start. The chart never moves the bar to it; a bar that starts at another time is drawn with the constraint violated, as the scheduler would report it. |
| Violation | A constraint is violated when the bar as drawn (the preview during a bar drag) starts before startNoEarlierThan or after startNoLaterThan, ends before finishNoEarlierThan or after finishNoLaterThan, or starts at another time than fixedStart. timelineConstraintViolated(range, kind, time) gives the same answer. |
| constraintsEditable | boolean / false. Each constraint of an editable bar (TimelineBar.editable, independent of editBounds, like the progress slider) becomes a handle that can be dragged and moved with the keys. No handles are drawn when readonly is set; other bars keep decorative markers. |
| constraint-edit(change) | TimelineConstraintEdit: id (the bar), kind, before (the bar's value), after (the proposed value, or undefined to remove the constraint) and source (pointer or keyboard). The component applies nothing; accept it with applyTimelineConstraintEdit(bars, change). A change to the same value is not proposed. |
| validateConstraintEdit / constraint-edit-rejected(change, reason) | Synchronous ConstraintEditValidator with the same convention as validateEdit; false uses GanttLabels.constraintRejected (default "This constraint change was rejected."). The reason is announced in the live region. |
| GanttLabels.startNoEarlierThan / startNoLaterThan / finishNoEarlierThan / finishNoLaterThan / fixedStart | Text of each kind in descriptions and handle names. Defaults "Start no earlier than", "Start no later than", "Finish no earlier than", "Finish no later than" and "Must start on". |
| GanttLabels.constraintViolated | Added after a violated constraint in descriptions and aria-valuetext. Default "violated". |
| GanttLabels.constraintHint | Description of every handle. Default "Arrow keys move the constraint by one snap step, Shift+arrow and Page keys by one tick step. Delete removes it. Escape cancels a drag." |
vw-gantt-constraint | Class of a marker or handle, with vw-is-start or vw-is-finish (the bar end it bounds), vw-is-lower (no earlier than), vw-is-upper (no later than) or vw-is-fixed, and the states vw-is-violated and vw-is-dragging. Colours --vw-constraint and --vw-constraint-violated. |
Display. Each constraint inside range and the visible time window is drawn in the bar's lane at its time: a stem across the lane, with a flag at the top for a start bound or at the bottom for a finish bound. The flag is an arrow that points towards the allowed times, so "no earlier than" points to later times and "no later than" to earlier times; a fixed start is an I-beam with a bar at both ends. A violated constraint is drawn in --vw-constraint-violated with a dashed stem, which also distinguishes it in forced-colors mode. The glyphs differ from the deadline indicator (a downward triangle on a solid stem in --vw-deadline) and keep a halo in the surface colour over bars. Markers follow a bar's move, resize and row-drag previews, are culled with the rows and the time window like deadline indicators, are not drawn for the hidden rows of a collapsed parent, are mirrored in right-to-left charts and are printed. Without handles they are aria-hidden.
Accessibility. Every constraint of a bar is added to its description (aria-describedby and the title), after the critical, float, deadline and late entries and before the baseline entries, as the kind label and the time, for example "Start no earlier than 09 Nov 10:00. Finish no later than 09 Nov 17:00, violated." Accessible names do not change. The time uses formatTime.
Handles. With constraintsEditable, a handle is a button with role="slider", as the progress slider: a single value on an axis, operated by arrows, with aria-valuemin and aria-valuemax the editBounds (or range), aria-valuenow the time and aria-valuetext the formatted time, followed by ", violated" when it is. Its name is the kind label, " · " and the bar label, for example "Start no earlier than · Cut order B", and it is described by GanttLabels.constraintHint. Handles follow the link handles and the progress slider of the bar in tab order.
- Pointer: press the handle with the primary button (or touch) and drag along the time axis. The preview moves by whole
snapsteps from the constraint's value (displacement snapping, as bar moves) and stays insideeditBounds; release proposes it withsource: 'pointer'. The handle is focused on press, so Escape works at once. - Keys: ArrowRight and ArrowLeft move one
snapstep in the visual direction (in right-to-left charts ArrowLeft is later), ArrowUp and ArrowDown one step later and earlier. Shift with an arrow, and PageUp and PageDown, move by the current tick step. Home and End propose the start and end ofeditBounds. Delete or Backspace proposes removing the constraint (after: undefined). Each key press proposes one change from the bar's current value. Alt, Ctrl and Meta combinations are left to the page: on a bar they choose which end to resize, which has no meaning for a single time. WithcontextMenu, the ContextMenu key and Shift+F10 report the bar. - Removal is part of
constraintsEditableand does not depend on thedeletableprop: removing a constraint changes a bar, it does not delete one, asdependency-deletedoes not depend on it either. Reject it invalidateConstraintEditwhen it is not allowed. After the parent applies a removal, focus moves to the bar. - Cancellation: Escape, pointer cancellation, lost capture, a
contextmenuevent during the drag, the second touch of apinchZoompinch and any change of bars (which carry the constraints), rows, collapsed rows,range,editBounds,snap, the scale, zoom presets,readonly,constraintsEditableor the other props listed in the editing contract end the drag without a proposal. A press does not start a constraint drag while another gesture is in flight, and a constraint drag blocks other gestures until it ends.
Adding a constraint. The chart has no menu for it. With contextMenu, a right-click on a bar (or one of its handles) reports target: { kind: 'bar', id }, the bar's rowId and the time under the pointer, which is all an application needs to offer, for example, "Start no earlier than here". The proposal shape is the same as the chart's, with before: undefined:
ts
import {
applyTimelineConstraintEdit, type TimelineConstraintEdit, type TimelineConstraintKind, type TimelineContextMenu,
} from '@eightkk/vue-weave/core'
const menu = ref<TimelineContextMenu>()
function onContextMenu(event: TimelineContextMenu) {
if (event.target.kind === 'bar' && event.time !== undefined) menu.value = event // render your menu at clientX, clientY
}
function addConstraint(kind: TimelineConstraintKind) {
const { target, time } = menu.value!
if (target.kind !== 'bar' || time === undefined) return
const after = range.start + Math.round((time - range.start) / snap) * snap
bars.value = applyTimelineConstraintEdit(bars.value, { id: target.id, kind, before: undefined, after, source: 'pointer' })
}
function onConstraintEdit(change: TimelineConstraintEdit) {
bars.value = applyTimelineConstraintEdit(bars.value, change)
}exportSvg, exportPng and renderTimelineSvg draw the same glyphs with the colours of --vw-constraint and --vw-constraint-violated, each in a <g> with the same classes and a <title> such as "Finish no later than · Pack order A 09 Nov 17:00 · violated" (options constraintLabels and constraintViolatedLabel; the component passes its labels). toMsProjectXml writes a task's single constraint (or the finish pair at one time as Must Finish On); see Interchange exports. To schedule with the constraints, spread them into the tasks and pass the results back with scheduledBarFields; see Scheduling constraints from the chart.