A live JavaScript/jQuery example of jqxGantt, the jQWidgets Gantt component, with its complete source code below. It is one of 15 jqxGantt demos for jQuery.
source property – Determines the tasks that will be loaded inside the Timeline.dateStart property – Determines a specific starting date for the Timeline.durationUnit property – Determines in what unit is task duration property measured.hideTimelineHeaderDetails property – By default the Timeline has a three level header - timeline details, timeline second details and timeline header.tasks property – A getter that returns a flat structure as an array of all tasks inside the element.taskColumns property – Determines the columns that will be visible in the Task Tree.treeSize property – Determines the size(width) of the task table.timelineHeaderFormatFunction property – A format function for the Header of the Timeline.view property – Determines the viewing date range of the timeline.To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $.
The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxgantt.js, jqxgantt.api.js.
It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).
window.onload = () => {
const gantt = new jqxGantt('#gantt', {
view: 'week',
treeSize: '25%',
durationUnit: 'hour',
hideTimelineHeaderDetails: true,
timelineHeaderFormatFunction: (date, type, isHeaderDetailsContainer, dateValue) => {
if (!isHeaderDetailsContainer && type === 'day') {
return date.toLocaleDateString(this.locale, { day: 'numeric', month: 'short' });
}
return dateValue;
},
taskColumns: [
{
label: '',
value: 'overdue'
},
{
label: 'Employee',
value: 'label'
},
{
label: 'From',
value: 'dateStart',
formatFunction: (value, item) => {
return item.dateStart.toLocaleDateString('en', { hour: '2-digit', minute: '2-digit' });
}
},
{
label: 'Deadline',
value: 'deadline',
formatFunction: (value, item) => {
if (!item.deadline) {
return '';
}
return new Date(value).toLocaleDateString('en', { hour: '2-digit', minute: '2-digit' });
}
}
],
source: [
{
label: 'Stage 1',
synchronized: true,
deadline: '2026-10-30',
expanded: true,
tasks: [
{
label: 'Repairs',
dateStart: '2026-10-28T02:30:00',
duration: 9.5,
progress: 45,
deadline: '2026-10-28T11:00:00',
},
{
label: 'Rally',
dateStart: '2026-10-28T13:30:00',
duration: 12,
deadline: '2026-10-29T03:00:00'
},
{
label: 'Rankings Update',
dateStart: '2026-10-29T07:30:00',
duration: 8,
deadline: '2026-10-29T17:30:00'
}
]
},
{
label: 'Stage 2',
synchronized: true,
deadline: '2026-10-31:23:30:00',
expanded: true,
tasks: [
{
label: 'Repairs & Optimizations',
dateStart: '2026-10-30T07:30:00',
duration: 6,
deadline: '2026-10-30T14:00:00'
},
{
label: 'Stastics',
dateStart: '2026-10-31T07:30:00',
duration: 8
}
]
},
{
label: 'Stage 3',
synchronized: true,
expanded: true,
tasks: [
{
label: 'Preparation',
dateStart: '2026-11-01T06:30:00',
duration: 6,
deadline: '2026-11-01T12:00:00',
},
{
label: 'Rally',
dateStart: '2026-11-01T013:00:00',
duration: 13
},
{
label: 'Final Rankings',
dateStart: '2026-11-02T7:30:00',
duration: 12,
deadline: '2026-11-02T23:30:00'
},
{
label: 'Awards',
dateStart: '2026-11-03T06:00:00',
duration: 12,
deadline: '2026-11-04'
}
]
}
]
})
};
<div id="gantt"></div>
<div style="position: absolute; bottom: 5px; right: 5px;">
<a href="https://www.jqwidgets.com/" alt="https://www.jqwidgets.com/"><img alt="https://www.jqwidgets.com/" title="https://www.jqwidgets.com/" src="https://www.jqwidgets.com/wp-content/design/i/logo-jqwidgets.png"></a>
</div>