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-working-with-data/table-data/data.json
4
anychart.data.loadJsonFile(
5
'https://cdn.anychart.com/samples/gantt-working-with-data/table-data/data.json',
6
function (data) {
7
// create data tree on raw data represented as table structure
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 container id for the chart
17
chart.container('container');
18
19
// initiate chart drawing
20
chart.draw();
21
22
// zoom chart all dates range
23
chart.fitAll();
24
}
25
);
26
});