syncfusion-angular-gantt-chart
Syncfusion Angular Gantt Chart
A comprehensive skill for implementing and configuring the Syncfusion Angular Gantt Chart component (ejs-gantt). This covers everything from initial setup through advanced features like critical path, virtual scrolling, resource views, undo/redo, state persistence, localization, and export.
When to Use This Skill
Use this skill when you need to:
- Install and set up the Angular Gantt Chart component
- Bind local or remote data to the Gantt chart
- Configure task scheduling modes (Auto/Manual/Custom)
- Define task dependencies and predecessor relationships
- Add, edit, or delete tasks (cell, dialog, taskbar editing)
- Assign and manage resources
- Configure timelines, zooming, and tier formats
- Customize taskbars, labels, and data markers
- Filter, sort, search, or select rows/cells
- Enable toolbar, context menu, or undo/redo
- Export to Excel or PDF
- Implement virtual scrolling or state persistence
- Apply localization, RTL layout, or timezone configuration
- Work with holidays, event markers, critical path, or baseline
Documentation and Navigation Guide
Getting Started
π Read: references/getting-started.md
- Installation via
ng add @syncfusion/ej2-angular-gantt - CSS imports for all themes (material3, bootstrap5, fluent2, tailwind3)
- Setting up Angular standalone component with
importsandproviders - Binding data with
dataSourceandtaskFieldsβ self-referential vs hierarchical - Injecting feature services (EditService, FilterService, ToolbarService, etc.)
- Configuring timeline, toolbar, editing, filtering, sorting
gridLinesvalues:'Both'|'Horizontal'|'Vertical'|'None'actionFailureerror handling for common configuration mistakes
Data Binding
π Read: references/data-binding.md
- Default pattern: Self-referential flat array with
id+parentID(idMapping + parentIdMapping) β use this unless user explicitly asks for nested data - Hierarchical local data with
childarray β only when user explicitly requests nested/tree structure - Decision table: when to use self-referential vs hierarchical
- Remote data binding with
DataManagerand adaptors (ODataV4, WebApiAdaptor, UrlAdaptor) - Load-on-demand (virtual loading) with
loadChildOnDemandandhasChildMapping - Observable / RxJS data binding with
asyncpipe - Remote CRUD with
crudUrl,insertUrl,updateUrl,removeUrl,batchUrl - Common gotchas table (missing
isPrimaryKey, wrong adaptor, parent date issues)
Task Scheduling
π Read: references/task-scheduling.md
taskMode:'Auto'(default),'Manual','Custom'(per-task via boolean field)- Auto mode: dates calculated from dependencies, working time, and holidays
- Manual mode: all dates fixed as-is in data source; use
validateManualTasksOnLinkingto still adjust on link - Custom mode: per-task scheduling via mapped boolean field in data source
- Unscheduled tasks (
allowUnscheduledTasks) β partial dates, floating bars durationUnit:'Day'|'Hour'|'Minute'- Working days:
workWeekarray (default MonβFri);includeWeekend: truemakes all 7 days working - Working hours:
dayWorkingTimeβ array of{ from, to }ranges (default 8β17); affects hour-based durations - Baseline dates (
renderBaseline,baselineStartDate,baselineEndDate,baselineColor) - Work scheduling (effort-driven) with
workfield andworkUnit
Task Dependencies
π Read: references/task-dependencies.md
- Dependency types:
FS(Finish-to-Start),SS,FF,SFβ format:'2FS','3SS+1d' - Comma-separated multiple predecessors:
'2FS,3SS' - Predecessor lag/lead offsets with
d/h/munits autoUpdatePredecessorOffsetβ sync offset values with actual positions on loadallowParentDependencyβ enable parent-child and cross-hierarchy dependencies- Editing via connector line drag when
editSettings.allowTaskbarEditing: true actionBeginrequestType: 'validateLinkedTask'β handle dependency conflicts- Programmatic:
addPredecessor(),removePredecessor(),updateRecordById() connectorLineWidthandconnectorLineBackgroundfor connector styling
Task Constraints
π Read: references/task-constraints.md
- 8 constraint types: ASAP (0), ALAP (1), MSO (2), MFO (3), SNET (4), SNLT (5), FNET (6), FNLT (7)
- Map via
taskFields.constraintType(numeric) andtaskFields.constraintDate(Date) - Constraints enforced only in Auto mode; stored-but-passive in Manual mode
- Conflicts with dependencies surface in
actionBeginevent
Managing Tasks
π Read: references/managing-tasks.md
editSettings:allowEditing,allowAdding,allowDeleting,allowTaskbarEditing,mode('Auto'|'Dialog')- Cell editing with
editTypeper column:'numericedit','defaultedit','dropdownedit','booleanedit','datepickeredit' - Dialog editing with custom tab configuration (
addDialogFields,editDialogFields) - Programmatic:
addRecord(),updateRecordById(),deleteRecord(),openAddDialog(),openEditDialog(id) - Expand/collapse:
expandAll(),collapseAll(),expandByID(id),collapseByID(id); events:expanding,expanded,collapsing,collapsed - Validation via
actionBeginevent (args.cancel = trueto block) - Server CRUD via
actionComplete+requestTypeinspection - Indent / outdent hierarchy changes via toolbar or
indent()/outdent()methods
Splitting and Merging Tasks
π Read: references/splitting-and-merging.md
taskFields.segmentsfor hierarchical data;taskFields.segmentIdfor self-referential data- Split at load time or dynamically via dialog Segments tab or context menu
SplitTask - Merge via context menu
MergeTaskor by dragging segments together onTaskbarClickwithsegmentIndexto detect which segment was clicked- Limitations: no splits on parent/milestone tasks; incompatible with multi-taskbar resource view
Resources
π Read: references/resources.md
resources(data) +resourceFields(field mapping:id,name,unit,group)taskFields.resourceInfoto link resources to tasks- Resource view mode (
viewType: 'ResourceView') with row-per-resource display showOverAllocationAsMultiTaskbarβ stacked taskbars for over-allocated resources- Work-based scheduling:
workfield,taskType('FixedWork','FixedDuration','FixedUnit') - Work unit:
workUnit: 'Hour'|'Day'|'Minute'
Columns
π Read: references/columns.md
- Column
field,headerText,width,format,type,template,headerTemplate - Column reordering (
allowReordering), resizing (allowResizing) - Frozen columns (
freeze: 'Left'|'Right') β requiresFreezeService - Column spanning via
queryCellInfo treeColumnIndexfor tree expand/collapse column- WBS (Work Breakdown Structure) column with
columnType: 'WBS' - Column menu (
showColumnMenu) β sort, filter, auto-fit, column chooser isPrimaryKeyrequirement for CRUD operations
Timeline
π Read: references/timeline.md
timelineSettingsconfiguration- Top tier and bottom tier customization
- Timeline view modes (day/week/month/year)
- Formatter function with
(date, format, tier, mode)parameters - Timeline cell width (
timelineUnitSize) - Custom date formats
projectStartDateandprojectEndDate- Timeline view window (
viewStartDate/viewEndDate) - Week start day (
weekStartDay) - Automatic timescale update (
updateTimescaleView) - Weekend highlighting (
timelineSettings.showWeekend) - Timeline cells tooltip (
showTooltip) - Navigate timeline (
previousTimeSpan()/nextTimeSpan()) - Zooming in and out
Taskbar
π Read: references/taskbar.md
taskbarTemplate,parentTaskbarTemplate,milestoneTemplateβ full custom templateslabelSettings:leftLabel,rightLabel,taskLabel(field names or templates)queryTaskbarInfoβ dynamic styling:taskbarBgColor,progressBarBgColor,taskbarBorderColorindicators/ data markers on individual tasks:date,iconClass,label,tooltip- Tooltip customization via
tooltipSettings.taskbartemplate taskbarHeight,taskbarCornerRadius,allowTaskbarDragAndDrop
Filtering and Searching
π Read: references/filtering-and-searching.md
allowFiltering: true+FilterServiceβ menu and Excel filter typesfilterSettings.type:'Menu'(default) |'Excel'filterSettings.hierarchyMode:'Parent'|'Child'|'Both'|'None'- Initial filter on load via
filterSettings.columnsarray - Searching:
allowSearching: true+'Search'in toolbar searchSettings:fields,operator,ignoreCase- Programmatic:
filterByColumn(),clearFiltering(),search()
Sorting
π Read: references/sorting.md
allowSorting: true+SortServiceβ click column headers to sort- Disable per column:
{ field: 'TaskID', allowSorting: false } - Multi-column sort: Ctrl+click additional headers; Shift+click to remove
- Initial sort on load via
sortSettings.columnsarray - Programmatic:
sortColumn(),removeSortColumn(),clearSorting()
Rows
π Read: references/rows.md
rowDataBound/queryCellInfoβ dynamic row/cell stylingrowHeightβ uniform row height in pixels (must exceedtaskbarHeight)enableAltRowβ alternate row background (defaulttrue)rowTemplateβ fully custom row layout in TreeGrid panequeryRowInfowithrowSpanβ vertical cell spanningallowRowDragAndDropβ drag rows to reorder/reparent;rowDragStartHelper/rowDropevents
Selection
π Read: references/selection.md
allowSelection: true+SelectionServiceβ required for any selection featureselectionSettings.mode:'Row'(default) |'Cell'|'Both'selectionSettings.type:'Single'(default) |'Multiple'(Ctrl+click for multi-select)selectionSettings.enableToggleβ click to deselect already-selected row- Cell selection modes:
'Flow'|'Box'|'BoxWithBorder' - Programmatic:
selectRow(),selectRows(),selectCell(),clearSelection(),getSelectedRecords()
Scrolling
π Read: references/scrolling.md
enableVirtualization: true+VirtualScrollServiceβ DOM virtualization for large datasetsenableTimelineVirtualizationβ virtualize timeline columns independently- Splitter:
splitterSettings.position(percentage string or pixel value),columnIndex,view('Default'|'Grid'|'Chart') - Programmatic:
scrollToDate('04/02/2024'),scrollToTaskbar(taskId) - Virtual scroll limitations: row/column templates, grouping, and some aggregate features not supported
Toolbar
π Read: references/toolbar.md
ToolbarServicerequired; settoolbaras string array or mixedItemModelarray- Built-in items:
'Add','Edit','Delete','Update','Cancel','ExpandAll','CollapseAll','Search','Indent','Outdent','ZoomIn','ZoomOut','ZoomToFit','ExcelExport','CsvExport','PdfExport','CriticalPath','Undo','Redo','SplitTask','MergeTask','ColumnChooser' - Custom items via
ItemModel:text,id,prefixIcon,align,tooltipText { type: 'Separator' }for visual dividerstoolbarClickevent β useargs.item.idto identify clicked item (format:'{ganttId}_{itemId}')- Enable/disable programmatically:
enableToolbarItems()/disableToolbarItems()
Programmatic Methods
π Read: references/gantt-methods.md
- Column utilities:
autoFitColumns() - Edit control:
cancelEdit(),openAddDialog(),openEditDialog() - Task management:
deleteRecord(),convertToMilestone(),changeTaskMode(),updateRecordByID(),updateRecordByIndex(),updateTaskId(),updateDataSource(),updateProjectDates() - Toolbar control:
enableItems() - Expand/Collapse:
expandByIndex(),collapseByIndex() - Undo/Redo stacks:
clearUndoCollection(),clearRedoCollection(),getUndoActions(),getRedoActions() - Data retrieval:
getCurrentViewData(),getRecordByID(),getTaskByUniqueID(),getTaskInfo(),getTaskbarHeight(),getExpandedRecords(),getGanttColumns(),getGridColumns() - Formatting helpers:
getDurationString(),getWorkString() - DOM access:
getRowByID(),getRowByIndex() - Sorting:
removeSortColumn() - Selection:
selectCells() - Row reorder:
reorderRows() - Scrolling:
scrollToTask(),updateChartScrollOffset()
Events
π Read: references/events.md
- Lifecycle:
load,created,dataBound,destroyed - Edit lifecycle:
actionBegin(cancel withargs.cancel = true),actionComplete,actionFailure - Taskbar:
taskbarEditing,taskbarEdited,onTaskbarClick,queryTaskbarInfo - Row/cell:
rowDataBound,queryCellInfo,queryRowInfo,rowSelected,rowDeselected,cellSelected - Expand/collapse:
expanding,expanded,collapsing,collapsed - Export:
beforeExcelExport,excelExportComplete,beforePdfExport,pdfExportComplete,pdfQueryTaskbarInfo recordDoubleClickβ open custom edit on double click
Context Menu
π Read: references/context-menu.md
enableContextMenu: true+ContextMenuServiceβ right-click on rows or header- Default items include:
'AutoFitAll','AutoFit','SortAscending','SortDescending','Add','Edit','Delete','Save','Cancel','Indent','Outdent','TaskInformation','SplitTask','MergeTask' - Custom items via
ContextMenuItemModel:text,id,iconCss,target(row/header) contextMenuOpenβ dynamically hide/show items per rowcontextMenuClickβ handle item selection
Holidays and Event Markers
π Read: references/holidays-and-markers.md
DayMarkersServicerequired for both holidays and event markersholidays: array of{ from, to?, label, cssClass }β non-working days that extend task durationseventMarkers: array of{ day, label, cssClass, top? }β full-height vertical lines at specific dates- Custom styling per type via
cssClass+ CSS targeting.e-gantt-event-marker/.e-span-label topproperty staggers overlapping markers at the same date
Critical Path
π Read: references/critical-path.md
enableCriticalPath: true+CriticalPathServiceβ highlights zero/negative-slack tasks in red'CriticalPath'toolbar item β user toggle buttongetCriticalTasks()β returns array ofIGanttDataobjects withslackvaluequeryTaskbarInfo+ganttProperties.isCriticalβ conditional per-task coloring- CSS overrides:
.e-critical-path-container,.e-critical-connector-line - Rules: completed tasks (100%) excluded; parent/child criticality independent; auto-recalculates on any change
Export (Excel and PDF)
π Read: references/export.md
- Excel:
allowExcelExport: true+ExcelExportService; callexcelExport()/csvExport() - PDF:
allowPdfExport: true+PdfExportService; callpdfExport() ExcelExportProperties:fileName,dataSource,includeHiddenColumn,header,footerPdfExportProperties:fileName,pageOrientation,pageSize,fitToWidthSettings,ganttStyle,theme- PDF header/footer content types:
Text,Line,PageNumber,Image - Single-page export:
fitToWidthSettings.isFitToWidth: true - Blob export:
pdfExport({}, true)β blob available inpdfExportCompleteevent - Multi-Gantt export to one PDF via chained
pdfExport()withmultipleExport pdfQueryTaskbarInfoβ per-taskbar colors in PDF output
Undo / Redo
π Read: references/undo-redo.md
enableUndoRedo: true+UndoRedoServiceβ up to 10 steps by defaultundoRedoActionsarray β choose which action types are tracked (18 supported actions)undoRedoStepsCountβ configure history depth- Keyboard:
Ctrl+Z/Ctrl+Y; programmatic:undo()/redo() 'Undo'/'Redo'toolbar items auto-disable when history is exhausted
State Persistence
π Read: references/state-persistence.md
enablePersistence: trueβ saves filter/sort/column state tolocalStorageunder key'{id}gantt'- Requires unique
idon<ejs-gantt>element - Reset methods:
clearStorage(), remove localStorage key manually, or set newid - Immutable mode (
enableImmutableMode) β only re-renders changed rows for large-dataset performance - Loading animation:
loadingIndicator.indicatorTypeβ'Spinner'(default) |'Shimmer' - Manual spinner:
showSpinner()/hideSpinner()
Localization, RTL and Formatting
π Read: references/localization-rtl.md
localeproperty +setCulture()+L10n.load()β translate all Gantt UI strings- Full locale key reference for the
'gantt'namespace - RTL:
[enableRtl]="true"+locale="ar"β reverses layout direction timezoneβ IANA timezone string (e.g.'America/New_York','UTC') for consistent cross-region dates- Column date formatting:
formatstring or{ type: 'date', skeleton: 'yMd' } - Column number formatting:
'N2','C2','P1'etc.
Quick Start Example
import { Component } from '@angular/core';
import { GanttModule, EditService, SortService, FilterService, ToolbarService, SelectionService } from '@syncfusion/ej2-angular-gantt';
@Component({
imports: [GanttModule],
standalone: true,
providers: [EditService, SortService, FilterService, ToolbarService, SelectionService],
selector: 'app-root',
template: `
<ejs-gantt
[dataSource]="data"
[taskFields]="taskFields"
[height]="'450px'"
[toolbar]="toolbar"
[allowFiltering]="true"
[allowSorting]="true"
[editSettings]="editSettings">
</ejs-gantt>
`
})
export class AppComponent {
// Default: self-referential data (flat array with id + parentID)
// Use hierarchical (child array) only if user explicitly requests it
public data: object[] = [
{ TaskID: 1, TaskName: 'Project Initiation', StartDate: new Date('04/02/2024'), Duration: 5, Progress: 0, ParentID: null },
{ TaskID: 2, TaskName: 'Identify Site location', StartDate: new Date('04/02/2024'), Duration: 4, Progress: 50, ParentID: 1 },
{ TaskID: 3, TaskName: 'Perform Soil test', StartDate: new Date('04/02/2024'), Duration: 4, Progress: 50, ParentID: 1 },
{ TaskID: 4, TaskName: 'Soil test approval', StartDate: new Date('04/02/2024'), Duration: 4, Progress: 50, ParentID: 1, Predecessor: '3FS' }
];
public taskFields: object = {
id: 'TaskID', // idMapping
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
parentID: 'ParentID' // parentIdMapping β null = root task
};
public toolbar: string[] = ['Add', 'Edit', 'Delete', 'ExpandAll', 'CollapseAll', 'Search'];
public editSettings: object = { allowEditing: true, allowAdding: true, allowDeleting: true, allowTaskbarEditing: true };
}
Common Patterns
When user needs task editing
β Set editSettings.allowEditing: true, inject EditService
β Use mode: 'Auto' for cell editing, mode: 'Dialog' for dialog
When user needs large dataset performance
β Read references/scrolling.md β enable enableVirtualization: true + VirtualScrollService
When user needs to export data
β Read references/export.md β inject ExcelExportService or PdfExportService
When user needs resource management
β Read references/resources.md β configure resources + resourceFields
When user needs undo/redo
β Read references/undo-redo.md β inject UndoRedoService, set enableUndoRedo: true
When user needs localization or RTL
β Read references/localization-rtl.md β call L10n.load() before bootstrap, set locale and enableRtl
When user needs state persistence
β Read references/state-persistence.md β set enablePersistence: true and unique id
When user needs split/segment tasks
β Read references/splitting-and-merging.md β map taskFields.segments, inject EditService
Key Module Injections
| Feature | Service to Inject |
|---|---|
| Editing (add/edit/delete/taskbar drag) | EditService |
| Filtering | FilterService |
| Sorting | SortService |
| Toolbar | ToolbarService |
| Selection | SelectionService |
| Day Markers / Holidays / Event Markers | DayMarkersService |
| Critical Path | CriticalPathService |
| Excel / CSV Export | ExcelExportService |
| PDF Export | PdfExportService |
| Undo / Redo | UndoRedoService |
| Column Menu | ColumnMenuService |
| Context Menu | ContextMenuService |
| Virtual Scrolling | VirtualScrollService |
| Row Drag and Drop | RowDDService |
| Column Reordering | ReorderService |
| Frozen Columns | FreezeService |
| Column Resizing | ResizeService |
Key Props Reference
| Property | Type | Default | Description |
|---|---|---|---|
dataSource |
object[] | DataManager |
[] |
Task data β self-referential (flat) or hierarchical |
taskFields |
TaskFieldsModel |
β | Maps data fields to Gantt task properties |
height |
string | number |
'auto' |
Component height (e.g. '450px') |
taskMode |
string |
'Auto' |
Scheduling mode: 'Auto' | 'Manual' | 'Custom' |
editSettings |
EditSettingsModel |
β | Enable add/edit/delete/taskbar editing and edit mode |
toolbar |
string[] | ItemModel[] |
β | Toolbar buttons β requires ToolbarService |
allowFiltering |
boolean |
false |
Enable column filter menus β requires FilterService |
filterSettings |
FilterSettingsModel |
β | type, hierarchyMode, columns (initial filters) |
allowSorting |
boolean |
false |
Enable column sorting β requires SortService |
sortSettings |
SortSettingsModel |
β | columns array for initial sort on load |
allowSelection |
boolean |
true |
Enable row/cell selection β requires SelectionService |
selectionSettings |
SelectionSettingsModel |
β | mode, type, enableToggle, cellSelectionMode |
enableCriticalPath |
boolean |
false |
Highlight critical path β requires CriticalPathService |
enableUndoRedo |
boolean |
false |
Enable undo/redo β requires UndoRedoService |
undoRedoActions |
string[] |
(all actions) | Which action types to track in history |
undoRedoStepsCount |
number |
10 |
Maximum undo/redo history depth |
enablePersistence |
boolean |
false |
Persist filter/sort/column state to localStorage |
enableImmutableMode |
boolean |
false |
Re-render only changed rows on data refresh |
allowExcelExport |
boolean |
false |
Enable Excel export β requires ExcelExportService |
allowPdfExport |
boolean |
false |
Enable PDF export β requires PdfExportService |
enableContextMenu |
boolean |
false |
Enable right-click context menu β requires ContextMenuService |
contextMenuItems |
string[] | ContextMenuItemModel[] |
(defaults) | Context menu items |
enableVirtualization |
boolean |
false |
DOM virtualization for large datasets β requires VirtualScrollService |
enableTimelineVirtualization |
boolean |
false |
Virtualize timeline columns |
renderBaseline |
boolean |
false |
Show baseline bars alongside current taskbars |
baselineColor |
string |
'red' |
Baseline bar color |
allowUnscheduledTasks |
boolean |
false |
Allow tasks missing start/end/duration |
validateManualTasksOnLinking |
boolean |
false |
Adjust manual task dates when dependency links change |
allowParentDependency |
boolean |
true |
Allow dependencies between parent/child tasks |
autoUpdatePredecessorOffset |
boolean |
false |
Sync predecessor offsets with actual positions on load |
highlightWeekends |
boolean |
false |
Shade weekend columns in timeline |
gridLines |
string |
'Both' |
Grid lines: 'Both' | 'Horizontal' | 'Vertical' | 'None' |
rowHeight |
number |
36 |
Height of each row in pixels |
enableAltRow |
boolean |
true |
Alternate row background color |
allowRowDragAndDrop |
boolean |
false |
Drag rows to reorder or reparent |
showColumnMenu |
boolean |
false |
Column header context menu β requires ColumnMenuService |
timelineSettings |
TimelineSettingsModel |
β | topTier, bottomTier, timelineUnitSize, weekStartDay |
timelineViewMode |
string |
β | Shortcut: 'Hour' | 'Day' | 'Week' | 'Month' | 'Year' |
projectStartDate |
Date | string |
(from data) | Fix timeline start bound |
projectEndDate |
Date | string |
(from data) | Fix timeline end bound |
holidays |
HolidayModel[] |
[] |
Non-working days with labels β requires DayMarkersService |
eventMarkers |
EventMarkerModel[] |
[] |
Vertical marker lines β requires DayMarkersService |
resources |
object[] |
β | Resource data array |
resourceFields |
ResourceFieldsModel |
β | Maps resource id, name, unit, group fields |
locale |
string |
'en-US' |
Culture code for localization (e.g. 'fr', 'ar') |
enableRtl |
boolean |
false |
Right-to-left layout |
timezone |
string |
(browser) | IANA timezone (e.g. 'UTC', 'America/New_York') |
durationUnit |
string |
'Day' |
Default duration unit: 'Day' | 'Hour' | 'Minute' |
workUnit |
string |
'Hour' |
Work scheduling unit: 'Hour' | 'Day' | 'Minute' |
workWeek |
string[] |
MonβFri | Working days: ['Monday','Tuesday','Wednesday','Thursday','Friday'] |
includeWeekend |
boolean |
false |
Treat all 7 days as working days |
dayWorkingTime |
object[] |
[{from:8,to:17}] |
Working hour ranges per day: [{ from: 8, to: 12 }, { from: 13, to: 17 }] |
dateFormat |
string |
'MM/dd/yyyy' |
Global date display format for all date columns |
splitterSettings |
SplitterSettingsModel |
β | position, columnIndex, view for TreeGrid/chart split |
loadingIndicator |
LoadingIndicatorModel |
β | indicatorType: 'Spinner' | 'Shimmer' |