DHTMLX Docs & Samples Explorer

Initialize object on page

It is easy to initialize object on page. Just create some div element on your page, it is better if you use absolute or relative style position for it. Then call create() method passign your div ID as an argument. This method will create html Gantt inside of your div. Remember, most of appearance related methods should be called before create(). They are mentioned in API reference grouped by Type, in “Initialization” and “Appearence” sections.

<div style="width:950px;height:620px;position:absolute" id="GanttDiv"></div>
<script>
        var gantt = new GanttChart();
        gantt.setImagePath("imgs/");
        gantt.setEditable(true);
        ...
        gantt.addProject(project_1);
        ...
        gantt.create("GanttDiv");
</script>