Documentation
The timeline is the right side of the Gantt chart: a header of dates above one row of bars per task. This page sets it up: the time unit of its columns, the dates it covers, the text of its header, a line for the current time, labelled date markers, scrolling to a task, and the widths of the tree and the timeline.
The examples are complete pages like the ones in Get started with jqxGantt, which explains the files they load, the task fields and how to set options and call methods. Each example is a single HTML page that needs no jQuery and no build step.
The view option sets the time unit of the timeline's columns. The header has two rows: the bottom row names each column, and the top row groups the columns.
view | Columns | Top row | Bottom row |
|---|---|---|---|
'day' | hours | the date: Mar 2, 2026 | 00:00, 01:00, ... |
'week' | days | the first day of each week: Mar 2, 2026 | Mon, Tue, ... |
'month' | days | the month: Mar 2026 | 2 Mon, 3 Tue, ... |
'month' with monthScale: 'week' | weeks, from Sunday | the month: Mar 2026 | week numbers: 9, 10, ... |
'quarter' | months | the quarters: Q1 2026 | Jan, Feb, ... |
'year' (the default) | months | the year: 2026 | Jan, Feb, ... |
monthScale chooses the columns of the month view: 'day' or 'week'. For jqxGantt the default is 'day' (the API reference says 'week').
The columns stretch to fill the timeline. When there are more than fit, as with a few weeks in the day view, the timeline scrolls.
This page plans an office move over two weeks of March 2026. Its buttons change the view, and a check box changes monthScale:
<p>
<button type="button" data-view="day">Day</button>
<button type="button" data-view="week">Week</button>
<button type="button" data-view="month">Month</button>
<button type="button" data-view="quarter">Quarter</button>
<button type="button" data-view="year">Year</button>
<label><input type="checkbox" id="monthWeeks"> Weeks in the month view</label>
</p>
<div id="gantt"></div>
const gantt = new jqxGantt('#gantt', {
theme: 'fluent',
width: '100%',
height: 'auto',
view: 'quarter',
treeSize: '30%',
source: [
{
id: 'move',
type: 'project',
label: 'Office move',
dateStart: '2026-03-02T00:00:00',
dateEnd: '2026-03-16T00:00:00',
expanded: true,
tasks: [
{ id: 'plan', type: 'task', label: 'Plan the move', dateStart: '2026-03-02T00:00:00', dateEnd: '2026-03-04T00:00:00' },
{ id: 'pack', type: 'task', label: 'Pack', dateStart: '2026-03-05T00:00:00', dateEnd: '2026-03-10T00:00:00' },
{ id: 'van', type: 'task', label: 'Moving day', dateStart: '2026-03-11T08:00:00', dateEnd: '2026-03-11T18:00:00' },
{ id: 'unpack', type: 'task', label: 'Unpack', dateStart: '2026-03-12T00:00:00', dateEnd: '2026-03-13T00:00:00' },
{ id: 'open', type: 'milestone', label: 'Open the new office', dateStart: '2026-03-16T00:00:00' }
]
}
]
});
A view is an option like any other, so a button sets gantt.view:
const chart = document.querySelector('#gantt jqx-gantt-chart');
const status = document.getElementById('status');
function setView(view) {
gantt.view = view;
// The quarter view hides the year row at the top. In 27.1.0 and earlier that row stays
// hidden in the other views afterwards, so show it again here.
if (view !== 'quarter') {
chart.querySelector('[jqx-id="timelineViewDetails"]').classList.remove('jqx-hidden');
}
showView();
}
function showView() {
status.textContent = `view: '${gantt.view}', monthScale: '${gantt.monthScale}'`;
}
showView();
for (const button of document.querySelectorAll('[data-view]')) {
button.addEventListener('click', () => setView(button.dataset.view));
}
// The month view shows days by default; 'week' shows week numbers instead.
document.getElementById('monthWeeks').addEventListener('change', (event) => {
gantt.monthScale = event.target.checked ? 'week' : 'day';
setView(gantt.view);
});
The quarter view hides the year row at the top of the header. In 27.1.0 and earlier that row stays hidden when you switch from the quarter view to another view, and the rows of the tree no longer line up with the bars. setView shows the row again whenever the new view is not 'quarter'.
Moving day runs from 08:00 to 18:00. A time in a date string must have seconds, as in '2026-03-11T08:00:00': the chart reads '2026-03-11T08:00' as midnight. Date objects, such as new Date(2026, 2, 11, 8), keep their time.
By default the timeline starts with the earliest task and ends with the latest one. dateStart and dateEnd make it start earlier or end later. This plan runs from March to June, and the timeline shows January to August:
const gantt = new jqxGantt('#gantt', {
theme: 'fluent',
width: '100%',
height: 'auto',
view: 'year',
// The timeline shows January to August, not only the months of the tasks.
dateStart: '2026-01-01T00:00:00',
dateEnd: '2026-08-31T00:00:00',
source: [
{ id: 'research', type: 'task', label: 'Research', dateStart: '2026-03-02T00:00:00', dateEnd: '2026-03-27T00:00:00' },
{ id: 'design', type: 'task', label: 'Design', dateStart: '2026-03-30T00:00:00', dateEnd: '2026-04-30T00:00:00' },
{ id: 'build', type: 'task', label: 'Build', dateStart: '2026-05-04T00:00:00', dateEnd: '2026-06-26T00:00:00' }
]
});
dateStart and dateEnd cannot hide tasks. With dateStart: '2026-04-01T00:00:00' and dateEnd: '2026-04-30T00:00:00', this timeline still shows March to June.
min and max are the first and last dates of the chart (by default January 1, 1900 and January 1, 2100). The timeline does not go past them, and a task date outside them is moved to the limit:
const gantt = new jqxGantt('#gantt', {
theme: 'fluent',
width: '100%',
height: 'auto',
view: 'year',
// No date before February 1 or after May 31, 2026.
min: '2026-02-01T00:00:00',
max: '2026-05-31T00:00:00',
source: [
{ id: 'research', type: 'task', label: 'Research', dateStart: '2026-01-05T00:00:00', dateEnd: '2026-02-27T00:00:00' },
{ id: 'design', type: 'task', label: 'Design', dateStart: '2026-03-02T00:00:00', dateEnd: '2026-04-24T00:00:00' },
{ id: 'build', type: 'task', label: 'Build', dateStart: '2026-04-27T00:00:00', dateEnd: '2026-06-26T00:00:00' }
]
});
// The tasks after min and max: Research and Build are cut to the range.
const day = { month: 'short', day: 'numeric' };
document.querySelector('#gantt jqx-gantt-chart').whenReady(() => {
document.getElementById('status').textContent = gantt.getTasks()
.map((task) => `${task.label}: ${task.dateStart.toLocaleDateString('en-US', day)} to ${task.dateEnd.toLocaleDateString('en-US', day)}`)
.join(', ');
});
The timeline shows February to May, and the status line reads Research: Feb 1 to Feb 27, Design: Mar 2 to Apr 24, Build: Apr 27 to May 31. The tasks themselves have changed: getTasks() returns the new dates. Choose min and max outside the dates of your plan.
Six options set how the header writes dates:
| Option | Values (default first) | Example |
|---|---|---|
dayFormat | 'short', 'long', 'narrow', 'numeric', '2-digit' | Week view: Mon, Monday, M, 2, 02. Month view: 2 Mon, 2 Monday |
weekFormat | 'long', 'numeric' | Top row of the week view: Mar 2, 2026, or the week number 10 |
monthFormat | 'short', 'long', 'narrow', 'numeric', '2-digit' | Mar, March, M, 3, 03; also in dates, such as March 2, 2026 and March 2026 |
quarterFormat | 'short', 'long', 'numeric' | Q1 2026, Quarter 1 2026, 1 2026 |
yearFormat | 'numeric', '2-digit' | Top row of the year view: 2026, 26 |
hourFormat | 'default', 'numeric', '2-digit' | 08:00, 8 AM, 08 AM |
timelineHeaderFormatFunction is called for every cell of the header and returns its text. This month view has a column per week. Instead of week numbers, it shows the first day of each week:
const gantt = new jqxGantt('#gantt', {
theme: 'fluent',
width: '100%',
height: 'auto',
view: 'month',
monthScale: 'week',
monthFormat: 'long',
// Called for every header cell; returns the text of the cell.
timelineHeaderFormatFunction: (date, type, isHeaderDetails, value) => {
// The bottom row of this view shows week numbers: show the first day of each week instead.
if (type === 'week' && !isHeaderDetails) {
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });
}
return value;
},
source: [
{ id: 'research', type: 'task', label: 'Research', dateStart: '2026-03-02T00:00:00', dateEnd: '2026-03-20T00:00:00' },
{ id: 'design', type: 'task', label: 'Design', dateStart: '2026-03-23T00:00:00', dateEnd: '2026-04-10T00:00:00' },
{ id: 'build', type: 'task', label: 'Build', dateStart: '2026-04-13T00:00:00', dateEnd: '2026-04-24T00:00:00' }
]
});
The function gets four arguments:
date: a Date, the start of the cell. The first week here starts on Sunday, March 1.type: what the cell shows, such as 'month' or 'week'.isHeaderDetails: true in the rows above the bottom row. In the bottom row it is false, or undefined when the chart is first drawn, so test it with !isHeaderDetails.value: the text the chart would show. It is not always a string: week numbers come as numbers (9), and the cells of the middle row (see below) come as HTML, such as '<div>Quarter 1</div>'.Return value for the cells you do not change.
Two options hide a header row: hideTimelineHeaderDetails: true hides the top row, and hideTimelineHeader: true hides the bottom row. The tree's header follows, so its rows still line up with the bars.
The year, quarter and month views can show a third row between the two. hideTimelineSecondHeaderDetails hides it, and is true by default. Set it to false to show the year, the quarters and the months in the quarter view:
const gantt = new jqxGantt('#gantt', {
theme: 'fluent',
width: '100%',
height: 'auto',
view: 'quarter',
// Show the middle row too: the year, the quarters, the months.
hideTimelineSecondHeaderDetails: false,
quarterFormat: 'long',
monthFormat: 'narrow',
source: [
{ id: 'research', type: 'task', label: 'Research', dateStart: '2026-01-05T00:00:00', dateEnd: '2026-02-27T00:00:00' },
{ id: 'design', type: 'task', label: 'Design', dateStart: '2026-03-02T00:00:00', dateEnd: '2026-04-24T00:00:00' },
{ id: 'build', type: 'task', label: 'Build', dateStart: '2026-04-27T00:00:00', dateEnd: '2026-06-26T00:00:00' }
]
});
With the third row, the year view shows the year, the quarters as month ranges (Jan-Mar) and the months; the month view shows the month, ranges of days and the days. The day and week views have no third row. In the quarter view the year is in fact the top row, and by default hideTimelineSecondHeaderDetails hides it there; this is why the quarter view shows Q1 2026 with the year.
Set these options when you create the chart. In 27.1.0 and earlier, hideTimelineHeaderDetails set back to false later does not show the top row again (hideTimelineHeader works both ways). In the quarter view with three rows, hideTimelineHeaderDetails hides two rows, and the tree's rows no longer line up with the bars.
Three options mark "now" in the timeline:
currentTime is the chart's current time. By default it is the time the chart was created.currentTimeIndicator: true draws a line at the current time and marks its column in the header.shadeUntilCurrentTime: true shades the timeline from its start to the current time.dateMarkers draws a dashed line with a label at other dates. Each marker has a label, a date and, if you want to style it, a className. This page fixes the current time at March 18, 2026, so it always looks the same, and marks a budget review and a trade fair:
/* The class of the Trade fair marker */
#gantt .fair-marker {
--jqx-gantt-chart-date-marker-background: #c2413d;
--jqx-gantt-chart-date-marker-color: #ffffff;
}
const gantt = new jqxGantt('#gantt', {
theme: 'fluent',
width: '100%',
height: 'auto',
view: 'quarter',
// A fixed "now", so that the page always looks the same. Leave it out to use the time the chart is created.
currentTime: '2026-03-18T00:00:00',
currentTimeIndicator: true,
shadeUntilCurrentTime: true,
dateMarkers: [
{ label: 'Budget review', date: '2026-04-06T00:00:00' },
{ label: 'Trade fair', date: '2026-05-18T00:00:00', className: 'fair-marker' }
],
source: [
{ id: 'research', type: 'task', label: 'Research', dateStart: '2026-01-05T00:00:00', dateEnd: '2026-02-13T00:00:00', progress: 100 },
{ id: 'design', type: 'task', label: 'Design', dateStart: '2026-02-16T00:00:00', dateEnd: '2026-03-27T00:00:00', progress: 70 },
{ id: 'build', type: 'task', label: 'Build', dateStart: '2026-03-30T00:00:00', dateEnd: '2026-05-29T00:00:00' },
{ id: 'test', type: 'task', label: 'Test', dateStart: '2026-05-11T00:00:00', dateEnd: '2026-06-19T00:00:00' },
{ id: 'launch', type: 'milestone', label: 'Launch', dateStart: '2026-06-26T00:00:00' }
]
});
The class of a marker is added to it, so a stylesheet can colour it with --jqx-gantt-chart-date-marker-background and --jqx-gantt-chart-date-marker-color. The check boxes of the page switch each part on and off; the line and the shading work without each other, and hideDateMarkers: true hides the markers:
<p>
<label><input type="checkbox" id="indicator" checked> Current time line</label>
<label><input type="checkbox" id="shade" checked> Shade the past</label>
<label><input type="checkbox" id="markers" checked> Date markers</label>
</p>
<div id="gantt"></div>
document.getElementById('indicator').addEventListener('change', (event) => {
gantt.currentTimeIndicator = event.target.checked;
});
document.getElementById('shade').addEventListener('change', (event) => {
gantt.shadeUntilCurrentTime = event.target.checked;
});
document.getElementById('markers').addEventListener('change', (event) => {
gantt.hideDateMarkers = !event.target.checked;
});
currentTime does not move by itself. The chart redraws the line every currentTimeIndicatorInterval seconds, but always at currentTime, so on a page that stays open the line stays where it was. To follow the clock, set gantt.currentTime = new Date() from a timer of your own, for example every minute: the line and the shading move at once. In 27.1.0 and earlier the chart redraws at most every 10 seconds, whatever the interval.
In 27.1.0 and earlier the line is drawn on the wrong day in the month view with daily columns (monthScale: 'day'). The day, week, quarter and year views and the month view with weekly columns place it correctly.
ensureVisible(id) scrolls the chart to a task: the timeline moves the column with the task's start to its left edge, and the rows scroll until the task's row is in view. This page has a year of tasks in weekly columns, too many to see at once, and a button for three of them:
<p>
<button type="button" data-task="research">Show Research</button>
<button type="button" data-task="build">Show Build</button>
<button type="button" data-task="launch">Show Launch</button>
</p>
<div id="gantt"></div>
const gantt = new jqxGantt('#gantt', {
theme: 'fluent',
width: '100%',
height: 300,
view: 'month',
monthScale: 'week',
// Scrolling to the end adds four more weeks.
infiniteTimeline: true,
infiniteTimelineStep: 4,
source: [
{ id: 'research', type: 'task', label: 'Research', dateStart: '2026-01-05T00:00:00', dateEnd: '2026-02-13T00:00:00' },
{ id: 'requirements', type: 'task', label: 'Requirements', dateStart: '2026-02-02T00:00:00', dateEnd: '2026-03-06T00:00:00' },
{ id: 'design', type: 'task', label: 'Design', dateStart: '2026-03-09T00:00:00', dateEnd: '2026-04-17T00:00:00' },
{ id: 'prototype', type: 'task', label: 'Prototype', dateStart: '2026-04-06T00:00:00', dateEnd: '2026-05-01T00:00:00' },
{ id: 'build', type: 'task', label: 'Build', dateStart: '2026-05-04T00:00:00', dateEnd: '2026-07-31T00:00:00' },
{ id: 'docs', type: 'task', label: 'Documentation', dateStart: '2026-06-01T00:00:00', dateEnd: '2026-08-28T00:00:00' },
{ id: 'test', type: 'task', label: 'Test', dateStart: '2026-08-03T00:00:00', dateEnd: '2026-09-25T00:00:00' },
{ id: 'pilot', type: 'task', label: 'Pilot', dateStart: '2026-09-28T00:00:00', dateEnd: '2026-10-30T00:00:00' },
{ id: 'training', type: 'task', label: 'Training', dateStart: '2026-10-12T00:00:00', dateEnd: '2026-11-20T00:00:00' },
{ id: 'launch', type: 'milestone', label: 'Launch', dateStart: '2026-12-01T00:00:00' }
]
});
Near the end of the timeline there is not enough room to bring a task to the left edge. Show Launch scrolls to the end instead, with Launch in view.
The chart raises four events when its scrolling reaches an edge: scrollLeftReached and scrollRightReached for the start and the end of the timeline, scrollTopReached and scrollBottomReached for the first and the last row. They are DOM events of the jqx-gantt-chart element, not options of jqxGantt, and they bubble, so the page listens on #gantt:
// Scroll the timeline (and the rows) to a task.
for (const button of document.querySelectorAll('[data-task]')) {
button.addEventListener('click', () => gantt.ensureVisible(button.dataset.task));
}
// The scroll events are DOM events of the chart; they bubble up to #gantt.
const host = document.getElementById('gantt');
const chart = host.querySelector('jqx-gantt-chart');
const status = document.getElementById('status');
const day = { year: 'numeric', month: 'short', day: 'numeric' };
host.addEventListener('scrollLeftReached', () => {
status.textContent = 'The start of the timeline';
});
host.addEventListener('scrollRightReached', () => {
status.textContent = `The end of the timeline: it now runs to ${new Date(chart.dateEnd).toLocaleDateString('en-US', day)}`;
});
host.addEventListener('scrollTopReached', () => {
status.textContent = 'The first row';
});
host.addEventListener('scrollBottomReached', () => {
status.textContent = 'The last row';
});
They fire for any scrolling, by the user or by ensureVisible: Show Launch reaches the end and fires scrollRightReached.
With infiniteTimeline: true, reaching the end also adds infiniteTimelineStep columns (5 by default) to the timeline. Here each step adds four weeks, and the status line shows the new end, which the chart element keeps in its dateEnd property. Setting infiniteTimeline back to false removes the added columns.
treeSize is the width of the task tree, in pixels or as a percentage of the chart ('20%' by default). Users can drag the bar between the tree and the timeline. treeMin (100 by default) and timelineMin (200) are the narrowest the tree and the timeline can be dragged:
const gantt = new jqxGantt('#gantt', {
theme: 'fluent',
width: '100%',
height: 'auto',
view: 'quarter',
// The tree starts at 35% of the width. Dragging the bar between the tree
// and the timeline keeps the tree at least 150 px wide and the timeline 300 px.
treeSize: '35%',
treeMin: 150,
timelineMin: 300,
taskColumns: [
{ label: 'Task', value: 'label', size: '60%' },
{ label: 'Start', value: 'dateStart', dateFormat: { month: 'short', day: 'numeric' } }
],
source: [
{ id: 'research', type: 'task', label: 'Research', dateStart: '2026-01-05T00:00:00', dateEnd: '2026-02-27T00:00:00' },
{ id: 'design', type: 'task', label: 'Design', dateStart: '2026-03-02T00:00:00', dateEnd: '2026-04-24T00:00:00' },
{ id: 'build', type: 'task', label: 'Build', dateStart: '2026-04-27T00:00:00', dateEnd: '2026-06-26T00:00:00' }
]
});
The two limits apply to dragging only. A treeSize set from code is used as it is: gantt.treeSize = '95%' leaves the timeline narrower than timelineMin.
When tasks have resources, a resource panel opens below the tasks. taskPanelSize is then the height of the task panel, and taskPanelMin (200 by default) its least height: taskPanelSize: 150 gives 200 pixels. Resources describes the panel.