How can I help you?
Timeline in EJ2 TypeScript Gantt Chart Control
10 Apr 202624 minutes to read
The timeline in the EJ2 TypeScript Gantt Chart control represents project durations as cells with defined units and formats, supporting in-built view modes like Hour-Minute, Day-Hour, Week-Day, Month-Week, Year-Month, and Minutes for flexible visualization. Configure modes using the timelineViewMode property, with top and bottom tiers customized via topTier.unit and bottomTier.unit in timelineSettings. This enables detailed views, such as weekly overviews with daily breakdowns for projects, ensuring accurate timeline representation.
Configure timeline view modes
Set the timeline view mode using the timelineViewMode property. This property allows you to switch the timeline between different units such as Day, Week, Month, and Year, where the top tier displays a broader unit and the bottom tier displays a finer one.
When both the topTier and bottomTier settings are defined, they take precedence over the timelineViewMode property. In this case, the timelineViewMode value will be ignored. To apply the timelineViewMode setting, ensure that topTier and bottomTier are assigned a null value or not configured.
Week timeline mode
In Week mode, the top tier shows weeks and the bottom tier days, suitable for short-term project tracking.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
},
timelineSettings: {
timelineViewMode: 'Week'
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="es5-datasource.js" type="text/javascript"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Month timeline mode
In Month mode, the top tier shows months and the bottom tier weeks, ideal for medium-term planning.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
},
timelineSettings: {
timelineViewMode: 'Month',
timelineUnitSize: 150
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Year timeline mode
In Year mode, the top tier shows years and the bottom tier months, suitable for long-term projects.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
},
timelineSettings: {
timelineViewMode: 'Year',
timelineUnitSize: 150
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Day timeline mode
In Day mode, the top tier shows days and the bottom tier hours, ideal for detailed daily scheduling.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
},
timelineSettings: {
timelineViewMode: 'Day'
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Hour timeline mode
In Hour mode, the top tier shows hours and the bottom tier minutes, perfect for minute-level task tracking.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
},
timelineSettings: {
timelineViewMode: 'Hour'
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Minutes timeline mode
In Minutes timeline mode, the tier displays minute-level intervals, ideal for tracking short-duration tasks with high precision.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
},
timelineSettings: {
timelineViewMode: 'Minutes'
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Timeline view dates
The Gantt Chart control supports rendering a fixed timeline range using the viewStartDate and viewEndDate properties. These properties allow the visible portion of the timeline to be explicitly defined and locked within the Gantt chart UI, independent of the project’s overall scheduling boundaries defined by projectStartDate and projectEndDate. The projectStartDate and projectEndDate values represent the full scheduling window for the project and are used for baseline processing, critical-path calculations, and project-level reporting. By default, both viewStartDate and viewEndDate are set to auto. The following example demonstrates how to configure a custom timeline view range.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'parentID'
},
timelineSettings: {
viewStartDate: new Date('04/03/2019'),
viewEndDate: new Date('04/07/2019'),
},
projectStartDate: new Date('03/31/2019'),
projectEndDate: new Date('04/13/2019')
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Key behaviors
When viewStartDate and viewEndDate are set to concrete Date values, the timeline rendering is restricted to the inclusive range [viewStartDate, viewEndDate].
- When
viewStartDateis set to auto:- If
projectStartDateis defined, the timeline begins atprojectStartDate. - If
projectStartDateis not defined, the earliest task start date is used as the beginning of the visible range.
- If
- When
viewEndDateis set to auto:- If
projectEndDateis defined, the timeline ends atprojectEndDate. - If
projectEndDateis not defined, the maximum task end date is used. If this end date leaves visible white-space in the timeline area, the end date is automatically extended to fill the chart width.
- If
Note: The
ZoomToFitfeature usesprojectStartDateandprojectEndDateto fit the entire project within the available timeline viewport.
Customize week start day
In the Gantt Chart control, you can customize the starting day of the week using the weekStartDay property. By default, the weekStartDay value is set to 0, which specifies Sunday as the first day of the week. You can change this value to any number from 0 to 6 to set a different start day.
The weekStartDay property will take effect only when the timeline displays weeks. To enable this, set the timelineViewMode to Week, or configure topTier.unit as Week and bottomTier.unit as Day.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
},
timelineSettings: {
timelineViewMode: 'Week',
weekStartDay: 3
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Customize automatic timescale update action
In the Gantt Chart control, the schedule timeline will be automatically updated when the tasks date values are updated beyond the project start date and end date ranges. This can be enabled or disabled using the updateTimescaleView property.
import { Gantt, Edit } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
Gantt.Inject(Edit);
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
},
timelineSettings: {
updateTimescaleView: false
},
editSettings: {
allowEditing: true,
allowTaskbarEditing: true
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Dynamically change timeline mode
You can dynamically change the timeline mode in the Gantt Chart by updating the timelineSettings.timelineViewMode property using the change event of the ComboBox control.
import { Gantt, TaskFieldsModel } from '@syncfusion/ej2-gantt';
import { ComboBox, ChangeEventArgs } from '@syncfusion/ej2-dropdowns';
import { GanttData } from './datasource.ts';
const taskFields: TaskFieldsModel = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
};
const timelineOptions: object[] = [
{ Id: 'Week', Value: 'Week' },
{ Id: 'Day', Value: 'Day' },
{ Id: 'Month', Value: 'Month' }
];
const gantt: Gantt = new Gantt({
height: '430px',
dataSource: GanttData,
taskFields,
timelineSettings: { timelineViewMode: 'Week' }
});
gantt.appendTo('#Gantt');
const comboBox: ComboBox = new ComboBox({
dataSource: timelineOptions,
width: '200px',
fields: { text: 'Value', value: 'Id' },
index: 0,
change: (args: ChangeEventArgs) => {
gantt.timelineSettings.timelineViewMode = args.value as any;
gantt.refresh();
}
});
comboBox.appendTo('#timeline');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<input id="timeline" />
<div id='Gantt'></div>
</div>
</body>
</html>Timeline cells tooltip
In the Gantt Chart control, you can enable or disable the mouse hover tooltip of timeline cells using the timelineSettings.showTooltip property. The default value of this property is true.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'parentID'
},
timelineSettings: {
showTooltip: true
}
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Highlight weekends
Highlight weekends by setting showWeekend to true and workWeek to define weekdays, aiding in identifying non-working days in a project schedule.
import { Gantt } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
let gantt: Gantt = new Gantt({
dataSource: GanttData,
height: '450px',
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'parentID'
},
timelineSettings: {
showWeekend: false
},
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>Limitations:
- The
showWeekendfeature does not support baselines and not compatible with the manual task mode. - Non-working hours cannot be excluded when
showWeekendis set to false. - Holidays are not excluded from the timeline if
showWeekendis set to false.
Navigating Gantt Chart Timeline
You can adjust the Gantt Chart view by shifting the timeline forward or backward by one unit using the following methods:
-
previousTimeSpan: Moves the timeline backward by one unit from the current start point.
-
nextTimeSpan: Moves the timeline forward by one unit from the current end point.
import { Gantt, Columns, TaskFieldsModel } from '@syncfusion/ej2-gantt';
import { Button } from '@syncfusion/ej2-buttons';
import { GanttData } from './datasource.ts';
const taskFields: TaskFieldsModel = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
parentID: 'ParentID'
};
const columns: Columns[] = [
{ field: 'TaskID', headerText: 'Task ID', width: '100' },
{ field: 'TaskName', headerText: 'Task Name', width: '150' },
{ field: 'StartDate', headerText: 'Start Date', width: '150' },
{ field: 'Duration', headerText: 'Duration', width: '150' },
{ field: 'Progress', headerText: 'Progress', width: '150' }
];
let gantt: Gantt = new Gantt({
height: '430px',
dataSource: GanttData,
taskFields: taskFields,
timelineSettings: { timelineViewMode: 'Week' },
columns: columns
});
gantt.appendTo('#Gantt');
let prevBtn: Button = new Button({ content: 'Previous Week' });
prevBtn.appendTo('#previousWeek');
let nextBtn: Button = new Button({ content: 'Next Week' });
nextBtn.appendTo('#nextWeek');
(document.getElementById('previousWeek') as HTMLElement).addEventListener('click', () => {
gantt.previousTimeSpan();
});
(document.getElementById('nextWeek') as HTMLElement).addEventListener('click', () => {
gantt.nextTimeSpan();
});<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div style="margin-bottom:10px;">
<button id="previousWeek"></button>
<button id="nextWeek" style="margin-left:10px;"></button>
</div>
<div id='Gantt'></div>
</div>
</body>
</html>Timeline template
In the Gantt Chart control, you can customize timeline cells using the timelineTemplate property, allowing for the customization of HTML content within timeline cells. This feature enhances the visual appeal and enables personalized functionality.
When designing the timeline cells, you can utilize the following context properties within the template:
-
date: Defines the date of the timeline cells. -
value: Defines the formatted date value that will be displayed in the timeline cells. -
tier: Defines whether the cell is part of the top or bottom tier.
The following code example how to customize the top tier to display the week’s weather details and the bottom tier to highlight working and non-working days, with formatted text for holidays.
import { Gantt, Selection, Toolbar, DayMarkers, Edit, Filter } from '@syncfusion/ej2-gantt';
import { GanttData } from './datasource.ts';
Gantt.Inject(Selection, Toolbar, DayMarkers, Edit, Filter);
(<{ bgColor?: Function }>window).bgColor = (value: string, date: string): string => {
if (value === "S") {
return "#7BD3EA"
}
const parsedDate = new Date(date);
for (let i = 0; i < gantt.holidays.length; i++) {
const holiday = gantt.holidays[i];
const fromDate = new Date(holiday.from);
const toDate = new Date(holiday.to)
if (parsedDate >= fromDate && parsedDate <= toDate) {
return "#97E7E1";
}
}
return "#E0FBE2"
};
(<{ imagedate?: Function }>window).imagedate = () => {
const getImage = Math.floor(Math.random() * 5) + 1;
return getImage + ".svg";
}
(<{ holidayValue?: Function }>window).holidayValue = (value: string, date: string): string => {
const parsedDate = new Date(date);
for (let i = 0; i < gantt.holidays.length; i++) {
const holiday = gantt.holidays[i];
const fromDate = new Date(holiday.from);
const toDate = new Date(holiday.to)
if (parsedDate >= fromDate && parsedDate <= toDate) {
const options: any = { weekday: 'short' };
return parsedDate.toLocaleDateString('en-US', options).toLocaleUpperCase();
}
}
return value
}
let gantt: Gantt = new Gantt({
dataSource: GanttData,
allowSorting: true,
taskFields: {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
parentID: 'ParentID',
},
splitterSettings: {
columnIndex: 1
},
treeColumnIndex: 1,
allowSelection: true,
gridLines: "Both",
showColumnMenu: false,
highlightWeekends: true,
timelineSettings: {
topTier: {
unit: 'Week',
format: 'dd/MM/yyyy'
},
bottomTier: {
unit: 'Day',
count: 1
},
timelineUnitSize: 100
},
holidays: [{
from: "04/04/2019",
to: "04/05/2019",
label: " Public holidays",
cssClass: "e-custom-holiday"
},
{
from: "04/12/2019",
to: "04/12/2019",
label: " Public holiday",
cssClass: "e-custom-holiday"
}],
columns: [
{ field: 'TaskID', headerText: 'Task ID', visible: false },
{ field: 'TaskName', headerText: 'Task Name', width: 300 },
{ field: 'StartDate', headerText: 'Start Date' },
{ field: 'Duration', headerText: 'Duration' },
{ field: 'Progress', headerText: 'Progress' },
],
labelSettings: {
leftLabel: 'TaskName',
taskLabel: 'Progress'
},
timelineTemplate: "#TimelineTemplates",
height: '550px',
allowUnscheduledTasks: true,
projectStartDate: new Date('03/25/2019'),
projectEndDate: new Date('05/30/2019'),
});
gantt.appendTo('#Gantt');<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Gantt Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<script type="text/x-jsrender" id="TimelineTemplates">
${if(tier == 'topTier')}
<div class="e-header-cell-label e-gantt-top-cell-text" style="width:100%;background-color: #FBF9F1 ; font-weight: bold;height: 100%;display: flex; justify-content: center ; align-items: center; "title=${date}>
<div> ${value}</div>
<div style="width:20px; height: 20px; line-height: normal; padding-left: 10px; ">
<img style="width:100%; height:100%;" src =${imagedate()}>
</div>
</div>
${/if}
${if(tier == 'bottomTier')}
<div class="e-header-cell-label e-gantt-top-cell-text" style="width:100%;background-color: ${bgColor(value,date)}; text-align: center;height: 100%;display: flex; align-items: center; font-weight: bold;justify-content: center "title=${date}>
${holidayValue(value,date)}
</div>
${/if}
</script>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='Gantt'></div>
</div>
</body>
</html>