Loading...
Loading...
Implement and configure the Syncfusion Angular Gantt Chart component (ejs-gantt, GanttModule). Use this when building Angular applications with Gantt chart functionality, task scheduling, dependencies, or resource management. Covers component setup, task dependencies, taskbar editing, critical path analysis, resource allocation, timeline configuration, filtering, sorting, export, undo/redo, state persistence, and localization.
npx skill4agent add syncfusion/angular-ui-components-skills syncfusion-angular-gantt-chartejs-ganttng add @syncfusion/ej2-angular-ganttimportsprovidersdataSourcetaskFieldsgridLines'Both''Horizontal''Vertical''None'actionFailureidparentIDchildDataManagerloadChildOnDemandhasChildMappingasynccrudUrlinsertUrlupdateUrlremoveUrlbatchUrlisPrimaryKeytaskMode'Auto''Manual''Custom'validateManualTasksOnLinkingallowUnscheduledTasksdurationUnit'Day''Hour''Minute'workWeekincludeWeekend: truedayWorkingTime{ from, to }renderBaselinebaselineStartDatebaselineEndDatebaselineColorworkworkUnitFSSSFFSF'2FS''3SS+1d''2FS,3SS'dhmautoUpdatePredecessorOffsetallowParentDependencyeditSettings.allowTaskbarEditing: trueactionBeginrequestType: 'validateLinkedTask'addPredecessor()removePredecessor()updateRecordById()connectorLineWidthconnectorLineBackgroundtaskFields.constraintTypetaskFields.constraintDateactionBegineditSettingsallowEditingallowAddingallowDeletingallowTaskbarEditingmode'Auto''Dialog'editType'numericedit''defaultedit''dropdownedit''booleanedit''datepickeredit'addDialogFieldseditDialogFieldsaddRecord()updateRecordById()deleteRecord()openAddDialog()openEditDialog(id)expandAll()collapseAll()expandByID(id)collapseByID(id)expandingexpandedcollapsingcollapsedactionBeginargs.cancel = trueactionCompleterequestTypeindent()outdent()taskFields.segmentstaskFields.segmentIdSplitTaskMergeTaskonTaskbarClicksegmentIndexresourcesresourceFieldsidnameunitgrouptaskFields.resourceInfoviewType: 'ResourceView'showOverAllocationAsMultiTaskbarworktaskType'FixedWork''FixedDuration''FixedUnit'workUnit: 'Hour''Day''Minute'fieldheaderTextwidthformattypetemplateheaderTemplateallowReorderingallowResizingfreeze: 'Left''Right'FreezeServicequeryCellInfotreeColumnIndexcolumnType: 'WBS'showColumnMenuisPrimaryKeytimelineSettings(date, format, tier, mode)timelineUnitSizeprojectStartDateprojectEndDateviewStartDateviewEndDateweekStartDayupdateTimescaleViewtimelineSettings.showWeekendshowTooltippreviousTimeSpan()nextTimeSpan()taskbarTemplateparentTaskbarTemplatemilestoneTemplatelabelSettingsleftLabelrightLabeltaskLabelqueryTaskbarInfotaskbarBgColorprogressBarBgColortaskbarBorderColorindicatorsdateiconClasslabeltooltiptooltipSettings.taskbartaskbarHeighttaskbarCornerRadiusallowTaskbarDragAndDropallowFiltering: trueFilterServicefilterSettings.type'Menu''Excel'filterSettings.hierarchyMode'Parent''Child''Both''None'filterSettings.columnsallowSearching: true'Search'searchSettingsfieldsoperatorignoreCasefilterByColumn()clearFiltering()search()allowSorting: trueSortService{ field: 'TaskID', allowSorting: false }sortSettings.columnssortColumn()removeSortColumn()clearSorting()rowDataBoundqueryCellInforowHeighttaskbarHeightenableAltRowtruerowTemplatequeryRowInforowSpanallowRowDragAndDroprowDragStartHelperrowDropallowSelection: trueSelectionServiceselectionSettings.mode'Row''Cell''Both'selectionSettings.type'Single''Multiple'selectionSettings.enableToggle'Flow''Box''BoxWithBorder'selectRow()selectRows()selectCell()clearSelection()getSelectedRecords()enableVirtualization: trueVirtualScrollServiceenableTimelineVirtualizationsplitterSettings.positioncolumnIndexview'Default''Grid''Chart'scrollToDate('04/02/2024')scrollToTaskbar(taskId)ToolbarServicetoolbarItemModel'Add''Edit''Delete''Update''Cancel''ExpandAll''CollapseAll''Search''Indent''Outdent''ZoomIn''ZoomOut''ZoomToFit''ExcelExport''CsvExport''PdfExport''CriticalPath''Undo''Redo''SplitTask''MergeTask''ColumnChooser'ItemModeltextidprefixIconaligntooltipText{ type: 'Separator' }toolbarClickargs.item.id'{ganttId}_{itemId}'enableToolbarItems()disableToolbarItems()autoFitColumns()cancelEdit()openAddDialog()openEditDialog()deleteRecord()convertToMilestone()changeTaskMode()updateRecordByID()updateRecordByIndex()updateTaskId()updateDataSource()updateProjectDates()enableItems()expandByIndex()collapseByIndex()clearUndoCollection()clearRedoCollection()getUndoActions()getRedoActions()getCurrentViewData()getRecordByID()getTaskByUniqueID()getTaskInfo()getTaskbarHeight()getExpandedRecords()getGanttColumns()getGridColumns()getDurationString()getWorkString()getRowByID()getRowByIndex()removeSortColumn()selectCells()reorderRows()scrollToTask()updateChartScrollOffset()loadcreateddataBounddestroyedactionBeginargs.cancel = trueactionCompleteactionFailuretaskbarEditingtaskbarEditedonTaskbarClickqueryTaskbarInforowDataBoundqueryCellInfoqueryRowInforowSelectedrowDeselectedcellSelectedexpandingexpandedcollapsingcollapsedbeforeExcelExportexcelExportCompletebeforePdfExportpdfExportCompletepdfQueryTaskbarInforecordDoubleClickenableContextMenu: trueContextMenuService'AutoFitAll''AutoFit''SortAscending''SortDescending''Add''Edit''Delete''Save''Cancel''Indent''Outdent''TaskInformation''SplitTask''MergeTask'ContextMenuItemModeltextidiconCsstargetcontextMenuOpencontextMenuClickDayMarkersServiceholidays{ from, to?, label, cssClass }eventMarkers{ day, label, cssClass, top? }cssClass.e-gantt-event-marker.e-span-labeltopenableCriticalPath: trueCriticalPathService'CriticalPath'getCriticalTasks()IGanttDataslackqueryTaskbarInfoganttProperties.isCritical.e-critical-path-container.e-critical-connector-lineallowExcelExport: trueExcelExportServiceexcelExport()csvExport()allowPdfExport: truePdfExportServicepdfExport()ExcelExportPropertiesfileNamedataSourceincludeHiddenColumnheaderfooterPdfExportPropertiesfileNamepageOrientationpageSizefitToWidthSettingsganttStylethemeTextLinePageNumberImagefitToWidthSettings.isFitToWidth: truepdfExport({}, true)pdfExportCompletepdfExport()multipleExportpdfQueryTaskbarInfoenableUndoRedo: trueUndoRedoServiceundoRedoActionsundoRedoStepsCountCtrl+ZCtrl+Yundo()redo()'Undo''Redo'enablePersistence: truelocalStorage'{id}gantt'id<ejs-gantt>clearStorage()idenableImmutableModeloadingIndicator.indicatorType'Spinner''Shimmer'showSpinner()hideSpinner()localesetCulture()L10n.load()'gantt'[enableRtl]="true"locale="ar"timezone'America/New_York''UTC'format{ type: 'date', skeleton: 'yMd' }'N2''C2''P1'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 };
}editSettings.allowEditing: trueEditServicemode: 'Auto'mode: 'Dialog'references/scrolling.mdenableVirtualization: trueVirtualScrollServicereferences/export.mdExcelExportServicePdfExportServicereferences/resources.mdresourcesresourceFieldsreferences/undo-redo.mdUndoRedoServiceenableUndoRedo: truereferences/localization-rtl.mdL10n.load()localeenableRtlreferences/state-persistence.mdenablePersistence: trueidreferences/splitting-and-merging.mdtaskFields.segmentsEditService| Feature | Service to Inject |
|---|---|
| Editing (add/edit/delete/taskbar drag) | |
| Filtering | |
| Sorting | |
| Toolbar | |
| Selection | |
| Day Markers / Holidays / Event Markers | |
| Critical Path | |
| Excel / CSV Export | |
| PDF Export | |
| Undo / Redo | |
| Column Menu | |
| Context Menu | |
| Virtual Scrolling | |
| Row Drag and Drop | |
| Column Reordering | |
| Frozen Columns | |
| Column Resizing | |
| Property | Type | Default | Description |
|---|---|---|---|
| | | Task data — self-referential (flat) or hierarchical |
| | — | Maps data fields to Gantt task properties |
| | | Component height (e.g. |
| | | Scheduling mode: |
| | — | Enable add/edit/delete/taskbar editing and edit mode |
| | — | Toolbar buttons — requires |
| | | Enable column filter menus — requires |
| | — | |
| | | Enable column sorting — requires |
| | — | |
| | | Enable row/cell selection — requires |
| | — | |
| | | Highlight critical path — requires |
| | | Enable undo/redo — requires |
| | (all actions) | Which action types to track in history |
| | | Maximum undo/redo history depth |
| | | Persist filter/sort/column state to |
| | | Re-render only changed rows on data refresh |
| | | Enable Excel export — requires |
| | | Enable PDF export — requires |
| | | Enable right-click context menu — requires |
| | (defaults) | Context menu items |
| | | DOM virtualization for large datasets — requires |
| | | Virtualize timeline columns |
| | | Show baseline bars alongside current taskbars |
| | | Baseline bar color |
| | | Allow tasks missing start/end/duration |
| | | Adjust manual task dates when dependency links change |
| | | Allow dependencies between parent/child tasks |
| | | Sync predecessor offsets with actual positions on load |
| | | Shade weekend columns in timeline |
| | | Grid lines: |
| | | Height of each row in pixels |
| | | Alternate row background color |
| | | Drag rows to reorder or reparent |
| | | Column header context menu — requires |
| | — | |
| | — | Shortcut: |
| | (from data) | Fix timeline start bound |
| | (from data) | Fix timeline end bound |
| | | Non-working days with labels — requires |
| | | Vertical marker lines — requires |
| | — | Resource data array |
| | — | Maps resource |
| | | Culture code for localization (e.g. |
| | | Right-to-left layout |
| | (browser) | IANA timezone (e.g. |
| | | Default duration unit: |
| | | Work scheduling unit: |
| | Mon–Fri | Working days: |
| | | Treat all 7 days as working days |
| | | Working hour ranges per day: |
| | | Global date display format for all date columns |
| | — | |
| | — | |