An Angular Gantt chart component for interactive project timelines. Render tasks, dependencies, milestones, critical path, baselines, and annotations as a fully drag-and-drop schedule, with typed Inputs, EventEmitter Outputs, @ViewChild access, and first-class support for both standalone and module-based Angular applications.
📚 Documentation: apexcharts.com/apexgantt/docs · 🎬 Live demos: apexcharts.com/apexgantt/demos · 📦 npm: ngx-apexgantt · 📖 Guide: Angular Gantt Chart · 🌐 Hub: ApexGantt
npm install ngx-apexgantt apexgantt
# or
yarn add ngx-apexgantt apexganttRequires Angular 18, 19, 20, 21 or 22, and apexgantt 3.20.0 or later.
ApexGantt is included in the Premium plan and above and has no free tier. Without a key it renders with a trial watermark for evaluation.
Set your licence key once at application start, before any chart renders. Either call setApexGanttLicense before bootstrapping, or add provideApexGanttLicense to the application providers.
Standalone App:
// main.ts
import { bootstrapApplication } from "@angular/platform-browser";
import { setApexGanttLicense } from "ngx-apexgantt";
import { AppComponent } from "./app/app.component";
import { appConfig } from "./app/app.config";
// set license before bootstrapping
setApexGanttLicense("your-license-key-here");
bootstrapApplication(AppComponent, appConfig);Module-based App:
// main.ts
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import { setApexGanttLicense } from "ngx-apexgantt";
import { AppModule } from "./app/app.module";
// set license before bootstrapping
setApexGanttLicense("your-license-key-here");
platformBrowserDynamic().bootstrapModule(AppModule);With a provider (in app.config.ts, or the providers of your root NgModule):
import { ApplicationConfig } from "@angular/core";
import { provideApexGanttLicense } from "ngx-apexgantt";
export const appConfig: ApplicationConfig = {
providers: [provideApexGanttLicense("your-license-key-here")],
};import { Component } from "@angular/core";
import {
NgxApexGanttComponent,
TaskInput,
TaskUpdateSuccessEventDetail,
} from "ngx-apexgantt";
@Component({
selector: "app-root",
standalone: true,
imports: [NgxApexGanttComponent],
template: `
<ngx-apexgantt
[tasks]="tasks"
[pixelsPerDay]="25.7"
[height]="'500px'"
(taskUpdateSuccess)="onTaskUpdate($event)"
>
</ngx-apexgantt>
`,
})
export class AppComponent {
tasks: TaskInput[] = [
{
id: "task-1",
name: "Project Planning",
startTime: "01-01-2024",
endTime: "01-08-2024",
progress: 75,
},
{
id: "task-2",
name: "Development",
startTime: "01-09-2024",
endTime: "01-20-2024",
progress: 40,
dependency: "task-1",
},
];
onTaskUpdate(event: TaskUpdateSuccessEventDetail) {
console.log("Task updated:", event.updatedTask);
}
}import { Component } from "@angular/core";
import { TaskInput } from "ngx-apexgantt";
@Component({
selector: "app-gantt",
template: `
<ngx-apexgantt [tasks]="tasks" [pixelsPerDay]="25.7" [height]="'500px'">
</ngx-apexgantt>
`,
})
export class GanttComponent {
tasks: TaskInput[] = [
// your tasks...
];
}// app.module.ts
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { NgxApexGanttModule } from "ngx-apexgantt";
import { GanttComponent } from "./gantt.component";
@NgModule({
declarations: [GanttComponent],
imports: [BrowserModule, NgxApexGanttModule],
})
export class AppModule {}| Input | Type | Description |
|---|---|---|
options |
Partial<GanttUserOptions> |
Any ApexGantt options |
Each shortcut sets one option. When options sets the same key, options wins, both at first render and on later changes.
| Input | Type | Description |
|---|---|---|
tasks |
TaskInput[] |
Array of tasks (shortcut for options.series) |
pixelsPerDay |
number |
Continuous zoom level (pixels-per-day): 0.5 ≈ year, 4.9 ≈ month, 25.7 ≈ week, 80 = day |
theme |
'light' | 'dark' |
Color theme |
width |
string | number |
Chart width |
height |
string | number |
Chart height |
| Input | Type | Description |
|---|---|---|
className |
string |
CSS class(es) added to the <ngx-apexgantt> element |
After the chart has rendered, a changed input is applied with update(), sending only the option keys whose value changed, so the chart keeps its tasks, zoom and scroll position.
A theme toggle (the theme input or options.theme) sends { theme } plus the current value of every theme colour you set in options. From apexgantt 3.20.0 a theme switch resets the colours the theme owns to the new theme's defaults unless the same update passes them, so this is what keeps a custom barBackgroundColor through a light/dark toggle. The theme colours are annotationBgColor, annotationBorderColor, arrowColor, backgroundColor, barBackgroundColor, barTextColor, borderColor, cellBorderColor, criticalArrowColor, criticalBarColor, crosshairColor, fontColor, headerBackground, milestoneColor, rowBackgroundColors, summaryBarColor, tooltipBGColor and tooltipBorderColor; every other option carries over a theme switch on its own. Calling the update() method yourself passes your object through as it is, so include those colours in it when you switch the theme that way.
Inputs compare by reference, as everywhere in Angular. Replace an array or object to update it; a change made in place is not seen:
// seen: a new array
this.tasks = [...this.tasks, newTask];
// seen: a new options object; only enableTaskDrag is sent
this.options = { ...this.options, enableTaskDrag: false };
// NOT seen: same array, mutated in place
this.tasks.push(newTask);Removing a key from options resets that option to its default (or to the shortcut input for it, when one is set).
update() keeps the current task data. Edits made by dragging, updateTask, addTask, deleteTask, moveTask and dependency changes survive any update that does not pass series or parsing. A new tasks array (or options.series) is sent as series, which replaces the data and clears the undo history, so only replace it when the data really changed.
Every ApexGantt event has an Output of the same name. Each one emits the event's detail object.
| Output | Detail type | Fired when |
|---|---|---|
taskUpdate |
TaskUpdateEventDetail |
A task edit is committed (any edit path, see source) |
taskUpdateSuccess |
TaskUpdateSuccessEventDetail |
A task edit has been applied |
taskUpdateError |
TaskUpdateErrorEventDetail |
A task edit failed |
taskValidationError |
TaskValidationErrorEventDetail |
The task form failed validation |
taskDragged |
TaskDraggedEventDetail |
A task bar was dragged to a new position |
taskResized |
TaskResizedEventDetail |
A task bar was resized |
taskProgressChanged |
TaskProgressChangedEventDetail |
A task's progress handle was dragged |
taskAdded |
TaskAddedEventDetail |
A task was added with addTask() |
taskDeleted |
TaskDeletedEventDetail |
A task was removed with deleteTask() |
taskMoved |
TaskMovedEventDetail |
A task was re-parented with moveTask() |
dependencyAdded |
DependencyChangeEventDetail |
A dependency was created |
dependencyRemoved |
DependencyChangeEventDetail |
A dependency was removed |
dependencyArrowUpdate |
DependencyArrowUpdateDetail |
A dependency arrow was redrawn because a linked task moved |
selectionChange |
SelectionChangeEventDetail |
The set of selected tasks changed |
historyChange |
HistoryChangeEventDetail |
The undo/redo history changed |
sortChange |
SortChangeEventDetail |
The active sort changed |
filterChange |
FilterChangeEventDetail |
The active filter changed |
groupChange |
GroupChangeEventDetail |
The active grouping changed |
columnResize |
ColumnResizeEventDetail |
A task-list column was resized |
columnReorder |
ColumnReorderEventDetail |
Task-list columns were reordered |
taskUpdate and taskUpdateSuccess fire once for every committed edit, whatever made it (drag, resize, progress drag, dialog, inline edit, keyboard or updateTask), and their source field says which. To save edits, listen to taskUpdateSuccess alone: saving on taskDragged or taskResized as well saves the same edit twice. To save the links too, save getInstance().getTasks() with getInstance().getDependencies() (see Saving the chart) rather than rebuilding them from dependencyAdded and dependencyRemoved.
The events are delivered through the Outputs only. The underlying DOM events stop at the chart, so a listener for them on an element above <ngx-apexgantt> (or on document) does not receive them; bind to the Outputs instead.
Access these methods using @ViewChild:
import { Component, ViewChild } from "@angular/core";
import { NgxApexGanttComponent, TaskInput } from "ngx-apexgantt";
@Component({
standalone: true,
imports: [NgxApexGanttComponent],
template: `<ngx-apexgantt #ganttChart [tasks]="tasks"></ngx-apexgantt>`,
})
export class MyComponent {
@ViewChild("ganttChart") ganttChart!: NgxApexGanttComponent;
tasks: TaskInput[] = [
// your tasks...
];
zoomIn() {
this.ganttChart.zoomIn();
}
zoomOut() {
this.ganttChart.zoomOut();
}
updateTask() {
this.ganttChart.updateTask("task-1", { progress: 80 });
}
updateAll() {
this.ganttChart.update({ pixelsPerDay: 4.9 });
}
undo() {
// any ApexGantt method, through the instance
this.ganttChart.getInstance()?.undo();
}
}| Method | Parameters | Description |
|---|---|---|
update |
options: Partial<GanttUserOptions> |
Update only the options passed; the rest keep their current values |
updateTask |
taskId: string, taskData: Partial<TaskInput>, options?: { silent?: boolean } |
Update one task. silent: true suppresses taskUpdate and taskUpdateSuccess (for server echoes and rollbacks) |
zoomIn |
none | Zoom in the gantt chart |
zoomOut |
none | Zoom out the gantt chart |
destroy |
none | Destroy the gantt instance and remove its event listeners |
getInstance |
none | The underlying ApexGantt instance, for any method not listed here; null before the first render and after destroy() |
Every other ApexGantt method is on getInstance(), for example getTask, getTasks, getDependencies, expandTask, collapseTask, scrollToTask, addTask, deleteTask, moveTask, addDependency, canAddDependency, undo, redo, clearHistory, sort, filter, groupBy, getSelectedTasks and exportChart. getTask, getTasks, getDependencies, expandTask and collapseTask need apexgantt 3.20.0.
To save the chart as the user left it, read it from the instance: getTasks() returns every task with its edits, and getDependencies() returns every link as it is now ({ fromId, toId, type, lag }), including links added with addDependency() or drawn by the user, less any removed. A task's dependency holds only the link it was loaded with, so save both:
import type { DependencyLink } from "apexgantt"; // apexgantt 3.20.0
save() {
const gantt = this.ganttChart.getInstance();
if (!gantt) return;
this.api.saveChart({ tasks: gantt.getTasks(), links: gantt.getDependencies() });
}
// after loading the saved tasks into [tasks] and the chart has rendered
restoreLinks(links: DependencyLink[]) {
const gantt = this.ganttChart.getInstance();
if (!gantt) return;
for (const { fromId, toId, type, lag } of links) {
// the links the tasks carry are already there and are not accepted again
if (gantt.canAddDependency(fromId, toId).ok) gantt.addDependency(fromId, toId, { type, lag });
}
gantt.clearHistory(); // so the restore cannot be undone
}The component can be server-rendered. On the server it renders its empty container and stops there: it creates no chart, adds no event listeners, the methods above do nothing and getInstance() returns null. The chart is created in the browser when the component renders or hydrates there.
import { Component, ViewChild } from "@angular/core";
import { NgxApexGanttComponent, TaskInput } from "ngx-apexgantt";
@Component({
selector: "app-gantt-basic",
standalone: true,
imports: [NgxApexGanttComponent],
template: `
<div class="controls">
<button (click)="ganttChart.zoomIn()">Zoom In</button>
<button (click)="ganttChart.zoomOut()">Zoom Out</button>
</div>
<ngx-apexgantt
#ganttChart
[tasks]="tasks"
[pixelsPerDay]="25.7"
[height]="'500px'"
>
</ngx-apexgantt>
`,
})
export class GanttBasicComponent {
@ViewChild("ganttChart") ganttChart!: NgxApexGanttComponent;
tasks: TaskInput[] = [
{
id: "task-1",
name: "Planning",
startTime: "01-01-2024",
endTime: "01-10-2024",
progress: 100,
},
{
id: "task-2",
name: "Development",
startTime: "01-11-2024",
endTime: "01-25-2024",
progress: 60,
dependency: "task-1",
},
];
}import { Component } from "@angular/core";
import { FormsModule } from "@angular/forms";
import {
NgxApexGanttComponent,
GanttUserOptions,
TaskUpdateSuccessEventDetail,
TaskDraggedEventDetail,
} from "ngx-apexgantt";
@Component({
selector: "app-gantt-advanced",
standalone: true,
imports: [NgxApexGanttComponent, FormsModule],
template: `
<div class="controls">
<select [(ngModel)]="currentPixelsPerDay">
<option [ngValue]="80">Day</option>
<option [ngValue]="25.7">Week</option>
<option [ngValue]="4.9">Month</option>
</select>
<button (click)="toggleTheme()">Toggle Theme</button>
</div>
<ngx-apexgantt
[options]="ganttOptions"
[pixelsPerDay]="currentPixelsPerDay"
[theme]="currentTheme"
(taskUpdateSuccess)="onTaskUpdate($event)"
(taskDragged)="onTaskDragged($event)"
>
</ngx-apexgantt>
`,
})
export class GanttAdvancedComponent {
currentPixelsPerDay = 25.7;
currentTheme: "light" | "dark" = "light";
// ganttOptions does not set pixelsPerDay or theme, so the shortcut
// inputs control them. A zoom change sends only pixelsPerDay; a theme
// toggle sends theme plus barBackgroundColor, so the custom colour stays
ganttOptions: GanttUserOptions = {
series: [
{
id: "task-1",
name: "Design Phase",
startTime: "01-01-2024",
endTime: "01-15-2024",
progress: 75,
},
// more tasks...
],
height: "600px",
enableTaskDrag: true,
enableTaskResize: true,
barBackgroundColor: "#537CFA",
rowHeight: 32,
};
toggleTheme() {
this.currentTheme = this.currentTheme === "light" ? "dark" : "light";
}
onTaskUpdate(event: TaskUpdateSuccessEventDetail) {
console.log("Task updated:", event.updatedTask);
// save to backend
}
onTaskDragged(event: TaskDraggedEventDetail) {
console.log("Task dragged:", event.taskId, event.daysMoved);
}
}import { Component } from "@angular/core";
import { NgxApexGanttComponent, GanttUserOptions } from "ngx-apexgantt";
@Component({
selector: "app-gantt-parsing",
standalone: true,
imports: [NgxApexGanttComponent],
template: `<ngx-apexgantt [options]="ganttOptions"></ngx-apexgantt>`,
})
export class GanttParsingComponent {
// external data format from API
apiData = [
{
task_id: "T1",
task_name: "Design Phase",
start_date: "01-01-2024",
end_date: "01-15-2024",
completion: 75,
},
{
task_id: "T2",
task_name: "Development",
start_date: "01-16-2024",
end_date: "01-30-2024",
completion: 40,
},
];
ganttOptions: GanttUserOptions = {
series: this.apiData,
parsing: {
id: "task_id",
name: "task_name",
startTime: "start_date",
endTime: "end_date",
progress: "completion",
},
height: "500px",
};
}import { Component } from "@angular/core";
import {
NgxApexGanttComponent,
Task,
TaskInput,
TaskUpdateSuccessEventDetail,
TaskDraggedEventDetail,
TaskResizedEventDetail,
} from "ngx-apexgantt";
@Component({
selector: "app-gantt-events",
standalone: true,
imports: [NgxApexGanttComponent],
template: `
<ngx-apexgantt
[tasks]="tasks"
(taskUpdateSuccess)="handleTaskUpdate($event)"
(taskDragged)="handleTaskDragged($event)"
(taskResized)="handleTaskResized($event)"
>
</ngx-apexgantt>
<div class="event-log">
<h3>Event Log:</h3>
<pre>{{ eventLog }}</pre>
</div>
`,
})
export class GanttEventsComponent {
tasks: TaskInput[] = [
// your tasks...
];
eventLog = "";
handleTaskUpdate(event: TaskUpdateSuccessEventDetail) {
this.eventLog += `Task Updated: ${event.taskId}\n`;
// sync with backend: this fires for every edit, drags and resizes included
this.syncWithBackend(event.updatedTask);
}
handleTaskDragged(event: TaskDraggedEventDetail) {
this.eventLog += `Task Dragged: ${event.taskId} moved ${event.daysMoved} days\n`;
}
handleTaskResized(event: TaskResizedEventDetail) {
this.eventLog += `Task Resized: ${event.taskId} duration changed by ${event.durationChange}\n`;
}
async syncWithBackend(task: Task) {
// your API call here
}
}Customize task table column widths:
import { ColumnKey, GanttUserOptions } from "ngx-apexgantt";
ganttOptions: GanttUserOptions = {
series: tasks,
columnConfig: [
{
key: ColumnKey.Name,
title: "Task Name",
minWidth: "100px",
flexGrow: 3,
},
{
key: ColumnKey.StartTime,
title: "Start",
minWidth: "100px",
flexGrow: 1.5,
},
{
key: ColumnKey.Duration,
title: "Duration",
minWidth: "80px",
flexGrow: 1,
},
],
};Add visual annotations to highlight specific dates or date ranges:
ganttOptions: GanttUserOptions = {
series: tasks,
annotations: [
{
x1: "10-25-2024",
x2: "END_DATE",
label: {
text: "Sprint 1",
fontColor: "#333333",
},
},
],
};The library is fully typed. Import types as needed:
import {
NgxApexGanttComponent,
GanttUserOptions,
TaskInput,
ColumnKey,
TaskUpdateEventDetail,
TaskDraggedEventDetail,
} from "ngx-apexgantt";Every Output's detail type is exported under the name in the Outputs table. GanttOptions is exported as an alias of GanttUserOptions.
ngx-apexgantt wraps the apexgantt core engine. Using a different framework? All wrappers share the same engine and task data model:
- JavaScript:
apexgantt(GitHub) - React:
react-apexgantt(GitHub) - Vue:
vue-apexgantt(GitHub)
Contributions are welcome! Please feel free to submit a Pull Request.
See LICENSE for details. Commercial licenses available at apexcharts.com/pricing.
ngx-apexgantt is the Angular wrapper for ApexGantt, part of the ApexCharts family. One Gantt chart component for JavaScript, React, Angular, and Vue applications, with a consistent API across every framework wrapper.