Skip to content
OGE logoOGE

Gantt API

Complete API reference for @oge-ui/gantt. The kernel — the task-tree index, calendar-true time scales, forward auto-scheduling, the critical-path backward pass, orthogonal dependency routing and the gesture math — is pure TypeScript in the framework-free @oge-ui/gantt-engine package, which the React Gantt runs too; live demos are on the overview page.

Properties Methods Events Types

OgeGantt

oge-gantt

Properties 49

Data

Name Type DefaultDescription
tasksreadonly T[][]Task items — a plain array, copied into an internal working set; the input is never mutated. Edits surface through the past-tense events.
dependenciesreadonly D[][]Dependency links between tasks; same working-set semantics as tasks.
keyExpr / parentKeyExpr / titleExpr / startExpr / endExpr / progressExpr / colorExprstring | ((item: T) => unknown)'id' / 'parentId' / 'title' / 'start' / 'end' / 'progress' / 'color'Task field mapping: names (dotted paths reach nested objects) or getter functions. String dates parse as local wall time and write back in the same storage shape.
baselineStartExpr / baselineEndExprstring | ((item: T) => unknown)'baselineStart' / 'baselineEnd'Baseline plan fields — tasks with both render the original plan as a slim bar under the live bar.
dependencyKeyExpr / predecessorKeyExpr / successorKeyExpr / dependencyTypeExprstring | ((item: D) => unknown)'id' / 'predecessorId' / 'successorId' / 'type'Dependency field mapping. Types are 'FS' | 'SS' | 'FF' | 'SF' (dx numeric codes 0–3 also parse); missing type means FS.
resourcesreadonly OgeGanttResource[][]Resource choices: labels next to the bars, the multi-assignment tag editor in the task dialog, the workload band rows — and a resource's own calendar overrides workCalendar for its tasks (first assigned resource with a calendar wins).
resourceIdExprstring | ((item: T) => unknown)'resourceId'The task's assigned resource field — a single id or an array of ids (multi-assignment). Write-back preserves the storage shape: array stores stay arrays, scalar stores stay scalar while at most one id is assigned.
dependencyLagExpr / dependencyLagUnitExprstring | ((item: D) => unknown)'lag' / 'lagUnit'Link lag / lead: an amount (negative = lead) and its unit, 'days' (working days on a workCalendar) or 'hours'. Drawn as a +2d badge on the arrow, honoured by auto-scheduling for all four link types, edited in the dependency editor (double-click an arrow, or Enter on a clicked one) and in the predecessors column (3FS+2d).
manuallyScheduledExprstring | ((item: T) => unknown)'manuallyScheduled'Per-task scheduling mode — true pins the task: auto-scheduling never moves it, and a link it breaks is reported as a dependency conflict. Bars draw a hatched pattern.
constraintTypeExpr / constraintDateExprstring | ((item: T) => unknown)'constraintType' / 'constraintDate'Task constraint (MS Project vocabulary): 'ASAP' | 'ALAP' | 'SNET' | 'SNLT' | 'FNET' | 'FNLT' | 'MSO' | 'MFO' and its date. SNET/FNET set a floor, MSO/MFO pin the task, SNLT/FNLT cap it; links win over SNLT/FNLT/MSO and the violation is reported. ALAP slides the task as late as its successors allow (backward pass). A dated type without a date reads as ASAP.
deadlineExprstring | ((item: T) => unknown)'deadline'Target finish: a flag marker on the bar row, an overdue state (and a deadline conflict) when the task ends later.
segmentsExprstring | ((item: T) => unknown)'segments'Split tasks: [{ start, end }, …] — two or more pieces draw as separate bars joined by a dotted line; the task spans its pieces. Moving drags every piece; resizing moves the first piece's start or the last piece's end.
baselinesExprstring | ((item: T) => unknown)'baselines'Several baselines: [{ start, end }, …], index = baseline number − 1. Wins over baselineStartExpr/baselineEndExpr (which remain baseline 1). The toolbar shows a chooser when a task carries more than one.
unitsExpr / effortExprstring | ((item: T) => unknown)'units' / 'effort'Assignment units in % (a number for every assigned resource, an array aligned with the resource ids, or an id-keyed map; default 100) and work in hours (effortDriven).

Appearance & behavior

Name Type DefaultDescription
scaleType'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years''days'Timeline scale — calendar-true ticks (real month lengths, DST-safe). Two-way ([(scaleType)]); the toolbar zoom and Ctrl+wheel write it.
firstDayOfWeeknumber | undefined—First day of week (0 = Sunday) for the weeks scale; undefined resolves from the locale.
columnsreadonly OgeGanttColumn[]title / start / end / durationTask-list columns: built-in fields (title, start, end, duration, progress, wbs, predecessors, totalSlack, freeSlack, constraint, deadline, resources, units, effort) or any data field, with optional header, widthPx, format, editor (false = read-only), allowSorting and frozen (pinned to the start edge, frozen columns lead).
taskListWidthnumber360Initial width (px) of the task pane; the splitter between the panes drags.
taskTitlePosition'inside' | 'outside' | 'none''inside'Where the task title renders relative to its bar.
showDependencies / showRowLinesbooleantrueDependency arrows / horizontal row guides.
showCriticalPathbooleanfalseOutlines the zero-slack chain (backward-pass latest-finish relaxation over all four link types).
weekendsHighlighted / holidaysboolean / readonly Date[]true / []Off-day shading on the days scale.
weekendDaysreadonly number[] | undefined—Weekend days (0 = Sunday … 6 = Saturday) weekendsHighlighted shades. undefined resolves from the locale via Intl.Locale#getWeekInfo() (Friday + Saturday in he-IL), falling back to Saturday + Sunday. A workCalendar takes precedence.
workCalendarOgeGanttWorkCalendar | nullnullWork-time calendar ({ workingDays?, holidays? }, 0 = Sunday): shades every off day and makes auto-scheduling roll pushed starts onto working days, preserving durations in working days. The holidays input merges in; per-resource calendars override it per task.
showResourceWorkloadbooleanfalseRenders the per-resource workload band under the chart: merged assignment segments per resource, overallocated stretches (concurrent assignments) in the danger color.
stripLinesreadonly OgeGanttStripLine[][]Vertical markers: { start, end?, label?, color? } — a line without end, a shaded range with it (dx parity).
timeZonestring | undefinedundefinedThe display zone (IANA, e.g. 'America/New_York'); unset = the browser’s. Stored dates stay instants: the bars, the scale, the today marker, the progress line, strip lines and the work calendar’s working days follow this zone’s clocks (core’s Intl offset math — DST-exact, no time-zone database), and every edit, drag and dialog save writes the instant back.
localestring | undefined—BCP 47 locale for every Intl format; defaults to the config locale, then the browser locale.
messagesPartial<OgeGanttMessages>{}Per-instance message overrides, merged over the DI config per top-level block.
rtlEnabledboolean | undefinedundefinedRight-to-left layout: the task tree moves to the right, the timeline runs from right to left (dependency arrows, baselines, today line and drag tip included), pointer drags and the splitter invert their direction and the Left/Right keys mirror — Left expands a summary, Alt+Shift+Left indents and Ctrl+Left moves a bar later. Unset follows the page: the computed direction or the nearest dir attribute, read after the first render and kept current while it changes; an explicit value also sets dir on the host. The built-in context menu opens towards the inline-start side of the pointer and its back arrow mirrors (Right closes it in RTL), and the PNG / PDF exports mirror the picture while the Excel export writes a right-to-left sheet (MS Project XML is direction-neutral data).
selectedTaskKeyRowKey | nullnullThe selected task. Two-way ([(selectedTaskKey)]).

Scheduling

Name Type DefaultDescription
autoSchedulingbooleanfalseProject-level auto-scheduling: after every edit the engine places each auto-scheduled task at the earliest date its links (with lag) and constraint allow — moving tasks earlier as well as later — then slides ALAP tasks late (backward pass). Manually scheduled tasks stay put. scheduleProject() runs it on demand.
projectStartDate | nullnullWhere unlinked ASAP tasks start while auto-scheduling; null keeps their current start (only links and constraints move a task).
baselineIndexnumber0Which baseline renders (0-based); -1 hides baselines. Two-way ([(baselineIndex)]); the toolbar chooser writes it.
showProgressLine / statusDateboolean / Date | nullfalse / nullThe progress line: a zig-zag through every visible row from the status date to the point each started task's progress has reached (status date default: today).
showRollupsbooleanfalseDraws every child milestone onto its summary bar (useful when the summary is collapsed).
zoomPresetsreadonly OgeGanttZoomPreset[] | nullnullThe toolbar's scale chooser: { scaleType, tickWidth?, label? } entries; null lists one per scale (hours … years).

Task list

Name Type DefaultDescription
inlineEditingbooleanfalseEdits task-list cells in place: double-click a cell or press F2 on a row; Enter commits, Escape cancels, Tab / Shift+Tab commit and move along the row. Text, date, number, duration (days) and predecessor (3FS+2d, 5SS) editors; summaries keep their rolled-up dates read-only. Every commit is one undoable update through the cancelable pipeline.
allowSortingbooleanfalseHeader click / Enter sorts (ascending → descending → off) — siblings within each parent, WBS numbers keep the store order. aria-sort on the header.
allowColumnResizing / allowColumnReorderingbooleanfalseHeader edge drag or Alt+Left/Right (Shift: 1px) resizes a column; header drag or Ctrl+Shift+Left/Right moves it. Headers become one roving tab stop (Left/Right between them, Down into the rows).
filterRow / searchPanelbooleanfalseA filter row under the headers (per column) and a toolbar search box (any column): fold-insensitive “contains” on the cell text; matches keep their ancestors and open collapsed summaries.
selectionMode'single' | 'multiple''single''multiple': Ctrl/Cmd-click toggles, Shift-click and Shift+Up/Down extend, Ctrl+Space toggles, Ctrl+A selects all; Delete, Alt+Shift+Left/Right and the context menu act on the whole selection as one undo step.
selectedTaskKeysreadonly RowKey[][]Every selected key in multiple mode (the primary row is selectedTaskKey). Two-way ([(selectedTaskKeys)]).

Resources & views

Name Type DefaultDescription
effortDriven / hoursPerDayboolean / numberfalse / 8Effort-driven scheduling: changing a task's resources, units or work recomputes its finish as work ÷ (hoursPerDay × Σ units) in working days.
showResourceHistogrambooleanfalsePer-resource utilization rows under the chart: one bar per timeline period (units × overlap), a dashed capacity line (OgeGanttResource.capacity, default 100%), over-allocated periods in the danger colour; each row's accessible name summarizes the peak and the periods over capacity.
viewMode'tasks' | 'resources''tasks''resources' regroups the rows by resource (an Unassigned group last); assignment rows edit the real task. The toolbar toggle (shown when resources exist) writes the two-way model.

Editing gates

Name Type DefaultDescription
editingEnabledbooleantrueMaster editing switch (dx editing.enabled).
allowTaskAdding / allowTaskUpdating / allowTaskDeleting / allowDependencyAdding / allowDependencyDeletingbooleantruePer-capability editing gates.
readOnlybooleanfalseDisplay-only shorthand: equivalent to editingEnabled=false, hides every editing affordance.

Methods 24

Name Type Description
insertTask(taskData) / updateTask(taskData, patch) / deleteTask(taskData)voidProgrammatic CRUD through the same cancelable pipelines as interactive editing — one undo step each.
insertDependency(predecessorKey, successorKey, type?, options?) / deleteDependency(dependencyData)voidGuarded link CRUD; inserting runs the same cycle check as interactive drawing and takes an optional { lag, lagUnit }.
undo() / redo()voidSnapshot history — every applied edit, drags included, is exactly one step (depth: config undoLimit).
zoomIn() / zoomOut() / zoomToFit()voidSteps the scale (hours ⇄ days ⇄ weeks ⇄ months ⇄ quarters ⇄ years) / picks the scale that fits the whole plan and scrolls to it.
scrollToDate(date)voidScrolls the chart so date is in view.
expandAll() / collapseAll() / expandAllToLevel(level) / expandToTask(key)voidTree expansion control; expandToTask also selects and reveals the row.
showTaskDetailsDialog(taskData?)voidOpens the task dialog — edit form for the given task, prefilled create form without one.
indentTask(task) / outdentTask(task)voidReparents through the guarded update pipeline: indent makes the task a child of its previous sibling (MS Project parity), outdent lifts it to the grandparent. Also on the built-in context menu and Alt+Shift+Left/Right on the focused row.
focus()voidFocuses the task tree (roving row).
getExportData()OgeGanttExportData<T>Snapshot for the exporters: every task in tree order (collapse ignored), the resolved columns with pane-identical formatting, the chart range and the critical-path keys.

Scheduling, task list & selection

Name Type Description
scheduleProject()voidRuns the scheduling engine now — even with autoScheduling off — as one undo step.
updateDependency(dependencyData, patch)voidUpdates a link's fields (type, lag, lag unit…) through the cancelable dependencyUpdating pipeline; auto-scheduling re-runs.
getTaskSlack(key)OgeGanttSlack | nullTotal and free slack of a leaf task in days (working days on a calendar) — also the totalSlack / freeSlack columns.
setBaseline(index?)voidSaves every leaf task's current dates as baseline index (0-based, default 0) — MS Project “Set Baseline”, one undo step.
applyZoomPreset(index)voidApplies a zoom preset (scale + tick width) by index.
sortBy(field, direction?) / setFilter(field, text) / setSearchText(text) / clearFilters()voidProgrammatic sort (null clears), filter-row text and search.
setColumnWidth(field, widthPx) / moveColumn(field, toIndex)voidColumn width (clamped 40–600px) and order — the same paths as the header gestures, with their events.
editCell(task, field?)booleanOpens the inline editor on a cell (unset field = the first editable one); false when the cell is read-only.
getSelectedTasks() / selectAll() / clearSelection()OgeGanttTask<T>[] / voidThe multi-selection in tree order, select every visible task, clear.
deleteTasks(items) / indentTasks(tasks) / outdentTasks(tasks)voidBulk edits — each one undo step and one plural announcement.

Export entry points (lazy, optional peers)

Name Type Description
exportGanttToExcel(gantt, options?) / buildGanttExcelWorkbook(data, options?)@oge-ui/gantt/export-excelLazy Excel export (exceljs peer): the task tree as a typed worksheet — indented titles, bold summary rows, real Date cells, an appended resource column; a right-to-left sheet when the Gantt is RTL (rtl option overrides). Import the entry point dynamically so exceljs stays out of the initial bundle.
exportGanttToPdf(gantt, options?) / buildGanttPdfDocument(data, options?)@oge-ui/gantt/export-pdfLazy PDF export (jspdf peer): the chart drawn as vector graphics — scale header, bars with progress fill, summary brackets, milestone diamonds, optional critical-path outlining, multi-page pagination. An RTL Gantt exports mirrored — title column on the right, timeline running right to left, right-aligned text — unless rtl: false is passed. Text outside WinAnsi (Turkish ğ ş ı İ, Central European, Greek, Cyrillic) needs a Unicode TrueType font — per export, or once for every PDF via setOgePdfDefaultFont({ family, normal, bold }) from @oge-ui/behavior; without one the built-in Helvetica cannot draw it (a dev-mode warning says so).
exportGanttToPng(gantt, options?) / buildGanttCanvas(data, options?)@oge-ui/gantt/export-imageLazy PNG export with no dependencies — plain canvas drawing of the same chart (configurable width, pixel ratio, background and critical-path outlining), mirrored for an RTL Gantt like the PDF (rtl option overrides).
exportGanttToMsProject(gantt, options?) / importMsProjectXml(xml)@oge-ui/gantt/export-msprojectMS Project XML (MSPDI) without dependencies: the export writes tasks with WBS, outline levels, manual mode, constraints, deadlines and baselines, links with LinkLag, resources with max units, assignments with units and work, and the calendar (working weekdays + holiday exceptions), then downloads (download: false returns the XML only). The import parses with a small DOM-free reader (no Trusted Types sink, no DTD entities) into plain tasks / dependencies / resources / workCalendar in the default field names — bind them. Midnight-to-midnight dates map to 08:00–17:00 and back, so a round trip is lossless. MSPDI is direction-neutral data, so an RTL Gantt writes the same XML.

Events 12

Editing (cancelable pipeline)

Name Type Description
taskInserting / taskUpdating / taskDeletingOgeGanttTask*ingEvent<T>Cancelable pre-events — set cancel = true to veto before the store changes.
taskInserted / taskUpdated / taskDeletedOgeGanttTask*edEvent<T>Fired only for applied changes — persist from these.
dependencyInserting / dependencyDeletingOgeGanttDependency*ingEventCancelable link pre-events; inserting carries predecessorKey, successorKey and type.
dependencyInserted / dependencyDeletedOgeGanttDependency*edEvent<D>Applied link changes.
taskEditDialogShowingOgeGanttDialogShowingEvent<T>Cancelable, before the task dialog opens; replace formItems to customize the form (dx onTaskEditDialogShowing parity).

Interaction

Name Type Description
taskClick / taskDblClick / taskContextMenuOgeGanttTaskClickEvent<T>Bar/row pointer events with the normalized task and the raw MouseEvent. Right-click — or Shift+F10 / the ContextMenu key on a row — also opens the built-in context menu (edit, new task/subtask, indent/outdent, delete — labels in messages.menu; Up/Down/Home/End move, Escape or the inline-start arrow closes it and returns to the row); listen to taskContextMenu to add your own entries alongside it.
selectionChangedOgeGanttSelectionChangedEvent<T>Selection changed: task (the primary row, or null) and tasks (every selected task; multiple mode).
scaleTypeChange / selectedTaskKeyChangeOgeGanttScaleType / RowKey | nullThe two-way model outputs.

Scheduling & task list

Name Type Description
schedulingConflictOgeGanttSchedulingConflictEvent<T>The conflict set changed (also when it empties): conflicts with the task, the kind ('dependency' | 'constraint' | 'deadline'), the violated link / constraint / date and a readable message. Conflicted bars draw a dashed danger outline and a ! badge; their row labels name the conflict.
dependencyUpdating / dependencyUpdatedOgeGanttDependencyUpdat*Event<D>Cancelable link update (type / lag) and its applied twin.
sortChanged / columnResized / columnReorderedOgeGanttSortChangedEvent / OgeGanttColumnResizedEvent / OgeGanttColumnReorderedEventTask-list state changes: { field, direction } (null = cleared), { field, widthPx }, { field, fromIndex, toIndex }.
selectedTaskKeysChange / baselineIndexChange / viewModeChangereadonly RowKey[] / number / OgeGanttViewModeThe model halves of the multi-selection, the baseline chooser and the view toggle.

Types 17

Name Type Description
OgeGanttTask<T>interfaceThe normalized task — the payload of events and templates: key, parentKey, source (the original item), title, start/end, progress, color, baseline dates and baselines, isSummary/isMilestone, level, wbs, manuallyScheduled, constraintType/constraintDate, deadline, segments, resourceIds with aligned units, and effort.
OgeGanttDependency<D>interfaceThe normalized link: key, source, predecessorKey, successorKey, type, lag (negative = lead) and lagUnit.
OgeGanttDependencyType'FS' | 'SS' | 'FF' | 'SF'Finish-to-start, start-to-start, finish-to-finish, start-to-finish.
OgeGanttScaleType'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'The timeline scale units.
OgeGanttColumninterfaceA task-list column: { field, header?, widthPx?, format?, editor?, allowSorting?, frozen? }.
OgeGanttStripLineinterface{ start, end?, label?, color? } — a chart marker line or range.
OgeGanttWorkCalendarinterface{ workingDays?, holidays? } — the work-time calendar (0 = Sunday; default working week Monday-Friday).
OgeGanttResourceinterface{ id, text, color?, calendar?, capacity? } — one assignable resource (the resources item type); capacity (%, default 100) is the histogram's over-allocation line.
OgeGanttExportData<T> / OgeGanttExportColumn<T>interfaceThe exporter snapshot: tasks, columns (header + pane-identical text()), rangeStart/rangeEnd, critical keys, resourceText(), and (optional, for hand-built snapshots) dependencies, resources, workCalendar and slack.
OgeGanttTaskTitlePosition'inside' | 'outside' | 'none'Task title placement relative to the bar.
[ogeGanttTaskTemplate]structural directive (OgeGanttTaskTemplate)Replaces the bar's title content; context OgeGanttTaskTemplateContext: { $implicit: OgeGanttTask<T> }.
[ogeGanttTooltipTemplate]structural directive (OgeGanttTooltipTemplate)Replaces the hover tooltip's content (default: title, dates + duration, progress, resources); context OgeGanttTooltipTemplateContext: { $implicit: OgeGanttTask<T> }.
OgeGanttConstraintType / OgeGanttLagUnit'ASAP' | 'ALAP' | 'SNET' | 'SNLT' | 'FNET' | 'FNLT' | 'MSO' | 'MFO' / 'days' | 'hours'Constraint types and the lag unit.
OgeGanttSegment / OgeGanttSlackinterface{ start, end } (split piece or baseline) / { totalSlack, freeSlack } in days.
OgeGanttZoomPresetinterface{ scaleType, tickWidth?, label? } — one zoom-chooser entry.
OgeGanttSchedulingConflict<T> / OgeGanttConflictKindinterface{ key, task, kind, constraintType?, dependencyKey?, date?, message }.
OgeGanttViewMode / OgeGanttSelectionMode / OgeGanttSortDirection / OgeGanttCellEditorTypestring unions'tasks' | 'resources', 'single' | 'multiple', 'asc' | 'desc', 'text' | 'number' | 'date' | 'duration' | 'predecessor'.

Configuration

Properties 5

Name Type DefaultDescription
provideOgeGanttConfig(config)Provider—Configures every Gantt below the provider (OgeGanttConfigInput); shallow merge over OGE_DEFAULT_GANTT_CONFIG per top-level key — a partial messages replaces whole nested blocks. The token is OGE_GANTT_CONFIG (OgeGanttConfig).
messagesOgeGanttMessages—Every user-facing string, aria labels included: toolbar (OgeGanttToolbarMessages), columns (OgeGanttColumnMessages), dialog (OgeGanttDialogMessages), grid (OgeGanttGridMessages, aria templates with {token} placeholders) and announcements (OgeGanttAnnouncementMessages, live-region templates, ICU plurals for counts), plus the optional scales, scheduling and dependencyEditor blocks — keys added after 1.1 are optional and filled from English (fillGanttMessages). Defaults: OGE_DEFAULT_GANTT_MESSAGES.
localestring | undefined—BCP 47 locale for every Intl format in scope; a per-instance [locale] input wins.
rowHeightnumber36Fixed row height in px — the invariant behind the row virtualization of both panes.
undoLimitnumber50Undo history depth.

Notes

  • Dates are plain local Dates throughout (Intl-only house rule — no date library, no adapter, no timezone database). The time scales are calendar-true: month ticks span real month lengths and DST transitions never shift a bar.
  • No WAI-ARIA APG gantt pattern exists. The widget composes the treegrid pattern: the task pane is a role="treegrid" with roving-tabindex rows (arrows, Left/Right collapse/expand, Enter opens the dialog, Delete deletes), and the focused row drives its bar: Ctrl+Left/Right moves, Ctrl+Shift+Left/Right resizes as the keyboard equivalent of drag, announced through a polite live region. The chart itself is a focusable scroll region.
  • Binding plain arrays never mutates them — edits land in an internal working set and the past-tense events carry the data to persist. Every applied edit, interactive or programmatic, is exactly one snapshot undo/redo step.