HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
// The data used in this sample can be obtained from the CDN
3
// https://cdn.anychart.com/samples/gantt-live-editing/project-chart-editing/data.json
4
anychart.data.loadJsonFile(
5
'https://cdn.anychart.com/samples/gantt-live-editing/project-chart-editing/data.json',
6
function (data) {
7
// create data tree on raw data
8
var treeData = anychart.data.tree(data, 'as-table');
9
10
// create project gantt chart
11
var chart = anychart.ganttProject();
12
13
// set data for the chart
14
chart.data(treeData);
15
16
// set pixel position of the main splitter
17
chart.splitterPosition(220);
18
19
// make chart editable
20
chart.edit(true);
21
22
// set container id for the chart
23
chart.container('container');
24
25
// initiate chart drawing
26
chart.draw();
27
28
// zoom chart all dates range
29
chart.fitAll();
30
}
31
);
32
});