Skip to content

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.js and maxgrid.gantt.css from 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/gantt only (@maxgrid/gantt-core, @maxgrid/core and @maxgrid/license come with it) and import @maxgrid/gantt/gantt.css. @maxgrid/themes is not needed.

With a script tag ​

html
<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 ​

ts
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" below

Bundlers 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.

FieldMeaning
tasks[]A flat list. The tree comes from parentId; order inside a parent is sortNo.
id, parentIdStrings (so 64-bit ids are safe). Roots have parentId: null.
plannedStart, plannedEndYYYY-MM-DD, end inclusive. Both null = unscheduled: a row with no bar.
statusTODO, IN_PROGRESS, DONE, ON_HOLD, CANCELED
progressPct0 to 100
isMilestoneA task whose start equals its end is drawn as a diamond.
hasChildrentrue for a summary task. Your host sums its dates and progress.
versionAn 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 ​

OptionDefaultMeaning
zoom'day''day', 'week', 'month'
rowHeight32Row height in px, 8 to 200
barHeighthalf the row heightBar height
locale'ko''ko', 'en', 'ja': language of the header and messages
todaythe real dateYYYY-MM-DD, for tests and fixed screenshots
showToday, showWeekendstrueToday line, weekend and holiday shading
collapsed[]Summary task ids that start collapsed
ariaLabela default per languageAccessible name of the chart. Give each chart a different one if a page has several.
editablefalseDrag bars to change the schedule
resetScrollOnDatafalseScroll back to the start on every setData
licenseKeythe global keySee "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 ​

ts
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 listeners

Events ​

const off = gantt.on(name, fn); call off() to unsubscribe.

EventPayloadWhen
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.

ts
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-create and dependency-delete the same way. After a link is created, call setData again with the GanttDependency your 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:

ts
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).

FileRawgzipbrotli
maxgrid.gantt.min.js (script tag)119 KB44.1 KB38.2 KB
ESM with only createGantt bundled (bundler, minified)116 KB42.8 KB37.8 KB
maxgrid.gantt.css32 KB7.9 KB6.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.