HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
var data = [
3
{id: 1, nameField: 'Phase 1 - Strategic Plan', progressValue: 0.14, actualStart: '2000-02-24', actualEnd: '2000-02-27'},
4
{id: 2, nameField: 'Self-Assessment', parent: 1, progressValue: 0.25, actualStart: '2000-02-24', actualEnd: '2000-02-29'},
5
{id: 3, nameField: 'Define business vision', parent: 2, progressValue: 0, actualStart: '2000-02-24T24:00', actualEnd: '2000-02-25T09:00', connectTo: 4, connectorType: 'finish-start'},
6
{id: 4, nameField: 'Identify available skills, information and support', parent: 2, progressValue: 0, actualStart: '2000-02-26T00:00', actualEnd: '2000-02-26T09:00', connectTo: 5, connectorType: 'finish-start'},
7
{id: 5, nameField: 'Decide whether to proceed', parent: 2, progressValue: 0, actualStart: '2000-02-27', actualEnd: '2000-02-28T08:00', connectTo: 6, connectorType: 'finish-start'},
8
{id: 6, nameField: 'Define the Opportunity', parent: 1, progressValue: 0.27, actualStart: '2000-02-28T08:00', actualEnd: '2000-02-29'},
9
{id: 7, nameField: 'Research the market and competition', parent: 6, progressValue: 0, actualStart: '2000-02-26T08:00', actualEnd: '2000-02-27'},
10
{id: 8, nameField: 'Interview owners of similar businesses', progressValue: 0.6, actualStart: '2000-03-01T08:00', actualEnd: '2000-03-08T08:00', connectTo: 9, connectorType: 'finish-start'},
11
{id: 9, nameField: 'Identify needed resources', parent: '8', progressValue: 0, actualStart: '2000-03-09T00:00', actualEnd: '2000-03-10T09:00'}
12
];
13
14
var treeData = anychart.data.tree(data, 'as-table');
15
16
var mapping = treeData.mapAs({name: 'nameField'});
17
18
// Remove child by index.
19
mapping.removeChildAt(1);
20
21
var chart = anychart.ganttProject();
22
chart.data(mapping);
23
chart.title('Remove child by index');
24
chart.container('container');
25
chart.draw();
26
chart.fitAll();
27
});