Baseline and critical path
Since 1.8.0
Available from 1.8.0.
Both features are display only. The chart does not compute a schedule: it draws the dates and ids your server sends. Without the extra fields the chart looks exactly as before.
Baseline
A baseline is the original plan. Add baselineStart and baselineEnd (YYYY-MM-DD, or null) to a task and a thin bar is drawn right under its bar.
ts
gantt.setData({
tasks: [
{
id: '7' /* ... */,
plannedStart: '2026-12-14',
plannedEnd: '2026-12-23',
baselineStart: '2026-12-09',
baselineEnd: '2026-12-18',
},
],
dependencies,
calendars,
});- A task without both baseline dates has no thin bar. If no task has them, the baseline layer is not created.
- A broken or reversed date is skipped or read in the right order; it never throws.
- To hide the baseline, call
setDataagain without those fields. baselineVariance(task)from@maxgrid/gantt-corereturns{ startDays, endDays }in calendar days (plan minus baseline, positive means later), ornullwhen a date is missing.- Colors:
--mxg-gantt-baseline. The thin bar isaria-hidden; put the variance into your own text if screen reader users need it.
Critical path
The host computes the critical path (the chain whose delay delays the project) and sends the task ids.
ts
gantt.setData({ tasks, dependencies, calendars, criticalIds: ['3', '5', '7', '8'] });- Listed tasks get a critical outline (
mxg-gantt-bar--critical). Summary bars are not highlighted. - A dependency is drawn as critical when both its predecessor and successor are listed.
- Without
criticalIdsnothing changes. Send an empty list or callsetDatawithout it to turn the highlight off. - Colors:
--mxg-gantt-criticaland--mxg-gantt-critical-arrow.
Both work together with editing: after an accepted change, send the new critical ids with setData.
Examples
Gallery examples baseline and critical path (a select turns each one on and off).