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/resource-chart-editing/data.json
4
anychart.data.loadJsonFile(
5
'https://cdn.anychart.com/samples/gantt-live-editing/resource-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 resource gantt chart
11
var chart = anychart.ganttResource();
12
13
// set data for the chart
14
chart.data(treeData);
15
16
// make chart editable
17
chart.edit(true);
18
19
// set container id for the chart
20
chart.container('container');
21
22
// initiate chart drawing
23
chart.draw();
24
25
// zoom chart all dates range
26
chart.fitAll();
27
}
28
);
29
});