Using the Gantt chart without the grid
The Gantt chart works on its own. One createGantt call makes the chart, setData feeds it tasks, dependencies and calendars, and events tell you what the user did. You do not need the MaxGrid bundle, createGrid, attachGrid or createSplitView.
What you need
- Script tag:
maxgrid.gantt.min.jsandmaxgrid.gantt.cssfrom the CDN, exactly two files (they sit in the same version folder). No other CSS (maxgrid.css, themes) and no grid bundle (maxgrid.min.js). - npm: install
@maxgrid/ganttonly (@maxgrid/gantt-core,@maxgrid/coreand@maxgrid/licensecome with it) and import@maxgrid/gantt/gantt.css.@maxgrid/themesis not needed.
With a script tag
<link rel="stylesheet" href="https://cdn.maxmine.com/maxgrid/1.8.0/maxgrid.gantt.css" />
<div id="chart" style="height: 480px"></div>
<script src="https://cdn.maxmine.com/maxgrid/1.8.0/maxgrid.gantt.min.js"></script>
<script>
const gantt = MaxGridGantt.createGantt(document.getElementById('chart'), {
ariaLabel: 'Project plan',
locale: 'en',
});
gantt.setData({
tasks: [
{
id: '1',
parentId: null,
sortNo: 0,
name: 'Design',
status: 'IN_PROGRESS',
plannedStart: '2026-11-02',
plannedEnd: '2026-11-20',
progressPct: 60,
isMilestone: false,
hasChildren: false,
calendarId: null,
version: 1,
},
{
id: '2',
parentId: null,
sortNo: 1,
name: 'Build',
status: 'TODO',
plannedStart: '2026-11-23',
plannedEnd: '2026-12-18',
progressPct: 0,
isMilestone: false,
hasChildren: false,
calendarId: null,
version: 1,
},
],
dependencies: [{ id: 'd1', predecessorId: '1', successorId: '2', depType: 'FS', lagDays: 0 }],
calendars: [{ id: 'c1', name: 'Standard', workDays: 31, isDefault: true, exceptions: [] }],
});
gantt.on('row-select', (e) => console.log('selected', e.taskId));
</script>The element that holds the chart needs a height (the height: 480px above). The chart fills it and scrolls inside it.
With ESM
import { createGantt } from '@maxgrid/gantt';
import '@maxgrid/gantt/gantt.css';
const gantt = createGantt(document.getElementById('chart')!, { ariaLabel: 'Project plan' });
gantt.setData(data); // see "Data format" belowBundlers keep only what you use (sideEffects is off). From @maxgrid/core only the scroll-compression function is included.
Data format
setData({ tasks, dependencies, calendars, criticalIds? }). The chart draws the values as they are; it never recalculates dates.
| Field | Meaning |
|---|---|
tasks[] | A flat list. The tree comes from parentId; order inside a parent is sortNo. |
id, parentId | Strings (so 64-bit ids are safe). Roots have parentId: null. |
plannedStart, plannedEnd | YYYY-MM-DD, end inclusive. Both null = unscheduled: a row with no bar. |
status | TODO, IN_PROGRESS, DONE, ON_HOLD, CANCELED |
progressPct | 0 to 100 |
isMilestone | A task whose start equals its end is drawn as a diamond. |
hasChildren | true for a summary task. Your host sums its dates and progress. |
version | An optimistic-concurrency token for your host. The chart never touches it. |
dependencies[] | predecessorId, successorId, depType (FS, SS, FF, SF), lagDays |
calendars[] | workDays (sum of Mon=1, Tue=2, Wed=4, Thu=8, Fri=16, Sat=32, Sun=64) and exceptions (per-date days off or extra working days). One has isDefault: true. |
A server's snake_case response can be converted with normalizePmsData(raw) (see "PMS source" in Gantt chart). To change the data, call setData again.
Options
| Option | Default | Meaning |
|---|---|---|
zoom | 'day' | 'day', 'week', 'month' |
rowHeight | 32 | Row height in px, 8 to 200 |
barHeight | half the row height | Bar height |
locale | 'ko' | 'ko', 'en', 'ja': language of the header and messages |
today | the real date | YYYY-MM-DD, for tests and fixed screenshots |
showToday, showWeekends | true | Today line, weekend and holiday shading |
collapsed | [] | Summary task ids that start collapsed |
ariaLabel | a default per language | Accessible name of the chart. Give each chart a different one if a page has several. |
editable | false | Drag bars to change the schedule |
resetScrollOnData | false | Scroll back to the start on every setData |
licenseKey | the global key | See "License key" below |
An unknown option or a bad value throws RangeError. Leave verticalScroll out: it is for placing the chart next to a grid (the default 'own' makes the chart scroll vertically by itself).
Reading and controlling
gantt.setZoom('month'); // change the zoom
gantt.scrollToToday();
gantt.scrollToDate('2026-12-01', 'center');
gantt.fitToProject(); // pick the zoom that shows the whole project
gantt.selectRow('3'); // select without an event
gantt.collapse('1');
gantt.expandAll();
gantt.scrollToRow('9');
gantt.setOptions({ locale: 'ja' });
gantt.destroy(); // removes the chart and its listenersEvents
const off = gantt.on(name, fn); call off() to unsubscribe.
| Event | Payload | When |
|---|---|---|
row-select | { taskId } | A bar or row was selected (null = cleared) |
toggle-collapse | { taskId, collapsed } | A summary task was collapsed or expanded |
task-open | { taskId } | Double click or Enter |
viewport-change | { zoom, from, to } | Zoom or scroll settled on a new date range |
task-move | { intentId, taskId, plannedStart, plannedEnd } | Editing: a bar was moved |
task-resize | { intentId, taskId, edge, plannedStart, plannedEnd } | Editing: a bar's start or end was dragged |
task-progress | { intentId, taskId, progressPct } | Editing: the progress was changed |
dependency-create | { intentId, predecessorId, successorId, depType, lagDays } | Editing: a link was drawn |
dependency-delete | { intentId, dependencyId } | Editing: a link deletion was requested |
Editing, and the host confirming or reverting
Turn it on with editable: true. The chart never changes your data by itself. When the user drops a bar it only emits an intent event with an intentId, and the bar shows a "pending" mark. Your host asks the server and then answers.
const gantt = createGantt(el, { editable: true });
gantt.setData(data);
gantt.on('task-move', async (e) => {
const res = await fetch(`/api/tasks/${e.taskId}`, {
method: 'PATCH',
body: JSON.stringify({ plannedStart: e.plannedStart, plannedEnd: e.plannedEnd }),
});
if (res.ok) {
const saved = await res.json();
gantt.applyPatch({ intentId: e.intentId, tasks: [{ id: e.taskId, ...saved }] }); // confirm
} else {
gantt.revertIntent(e.intentId); // refused: the bar goes back
}
});- Handle
task-resize,task-progress,dependency-createanddependency-deletethe same way. After a link is created, callsetDataagain with theGanttDependencyyour server decided. - Keyboard: Tab enters the chart, ↑↓ pick a bar, Alt+←/→ move it, Ctrl+←/→ change the end date (full table in Gantt editing).
- Summary tasks cannot be edited (summing is the server's job).
License key
The Gantt needs a key from the "MaxGrid + Gantt" product. A key that covers the grid only puts the Gantt in evaluation mode. Pass the key one of two ways:
createGantt(el, { licenseKey: '...' }); // this chart only
MaxGrid.config({ licenseKey: '...' }); // the whole page (when the maxgrid bundle is loaded)Without the grid bundle use the licenseKey option. On a host that is not covered by the key (or without a key) an evaluation strip is shown under the chart. Development hosts (localhost, 127.0.0.1) work without a key. The rules are in License key.
Theming and dark mode
Every color is a CSS variable (--mxg-gantt-*), and the built-in light and dark defaults look complete without any grid CSS. Set variables on an ancestor or on .mxg-gantt-root (list: "Theme" in Gantt chart). For dark mode put data-mxg-theme="dark" on the root or an ancestor.
RTL (right to left)
Put dir="rtl" on the page or an ancestor and the header text and messages follow. The time axis still runs left to right in RTL (the chart's scroll area keeps direction: ltr): dragging a bar to the right means a later date.
Size
No grid bundle is included. Measured on the 1.8.0 build (compressed size with gzip and brotli).
| File | Raw | gzip | brotli |
|---|---|---|---|
maxgrid.gantt.min.js (script tag) | 119 KB | 44.1 KB | 38.2 KB |
ESM with only createGantt bundled (bundler, minified) | 116 KB | 42.8 KB | 37.8 KB |
maxgrid.gantt.css | 32 KB | 7.9 KB | 6.8 KB |
Only the visible window is drawn, so 5,000 rows scroll smoothly.
Accessibility
The chart is named by ariaLabel. With editing on, bars get a roving tabindex, and the reason for an action that is not possible appears in a role="status" region. The automated check (axe) finds 0 critical or serious violations.
Examples
Gallery: Gantt without the grid, Editing with an event log.