The DayPilot.Gantt constructor creates a JavaScript Gantt chart instance bound to a placeholder element and optionally initializes it using a configuration object.
Declaration
new DayPilot.Gantt(id, options)Parameters
id(string) - id of the placeholder<div>elementoptions(object) - configuration object that can include DayPilot.Gantt Properties, DayPilot.Gantt Events, and the special members listed below
Notes
In addition to the standard events and properties, the options parameter also supports these special properties:
tasks- initial task array that will be loaded totasks.listscrollTo- initial scroll position (DayPilot.Date object or string in ISO 8601 format)
Example
HTML
<div id="dp"></div>JavaScript
const gantt = new DayPilot.Gantt("dp");
gantt.theme = "gantt_white";
gantt.tasks.list = [
{ id: 1, start: "2015-01-01T00:00:00", end: "2015-01-01T15:00:00", text: "Task 1" }
];
gantt.init();
gantt.scrollTo("2015-01-01");Initialization with properties
const gantt = new DayPilot.Gantt("dp", {
theme: "gantt_white",
tasks: [
{ id: 1, start: "2015-01-01T00:00:00", end: "2015-01-01T15:00:00", text: "Task 1" }
],
scrollTo: "2015-01-01"
});
gantt.init();See Also
Task Loading [doc.daypilot.org]
Task Hierarchy [doc.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot