HTMLcopy
x
1
<script src="https://cdn.anychart.com/releases/8.10.0/js/anychart-core.min.js"></script>
2
<script src="https://cdn.anychart.com/releases/8.10.0/js/anychart-gantt.min.js"></script>
3
4
<script src="https://cdn.anychart.com/releases/8.10.0/js/anychart-data-adapter.min.js"></script>
5
6
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
26
1
anychart.onDocumentReady(function () {
2
anychart.data.loadJsonFile("https://gist.githubusercontent.com/shacheeswadia/21da3da501982400b8ca35690b17ea5a/raw/d17e3774c6db1502b5d95677a5656ecc43f24526/resourceChartData.json", function (data) {
3
4
// create a data tree
5
var treeData = anychart.data.tree(data, "as-tree");
6
7
// create a resource gantt chart
8
var chart = anychart.ganttResource();
9
10
// set the data
11
chart.data(treeData);
12
13
// fit the elements to the width of the timeline
14
chart.fitAll();
15
16
// set the position of the splitter to match the first column
17
chart.dataGrid().fixedColumns(true);
18
19
// set the container id
20
chart.container("container");
21
22
// draw the chart
23
chart.draw();
24
25
});
26
});