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
// Set Chinese locale before Gantt toolbar draw.
3
anychart.format.outputLocale('zh-cn');
4
5
var data = [
6
{
7
id: 1,
8
name: 'Phase 1 - Strategic Plan',
9
progressValue: 0.14,
10
actualStart: '2000-02-24',
11
actualEnd: '2000-02-27'
12
},
13
{
14
id: 2,
15
name: 'Self-Assessment',
16
parent: 1,
17
progressValue: 0.25,
18
actualStart: '2000-02-24',
19
actualEnd: '2000-02-29'
20
},
21
{
22
id: 3,
23
name: 'Define business vision',
24
parent: 2,
25
progressValue: 0,
26
actualStart: '2000-02-24T24:00',
27
actualEnd: '2000-02-25T09:00',
28
connectTo: 4,
29
connectorType: 'finish-start'
30
},
31
{
32
id: 4,
33
name: 'Identify available skills, information and support',
34
parent: 2,
35
progressValue: 0,
36
actualStart: '2000-02-26T00:00',
37
actualEnd: '2000-02-26T09:00',
38
connectTo: 5,
39
connectorType: 'finish-start'
40
},
41
{
42
id: 5,
43
name: 'Decide whether to proceed',
44
parent: 2,
45
progressValue: 0,
46
actualStart: '2000-02-27',
47
actualEnd: '2000-02-28T08:00',
48
connectTo: 6,
49
connectorType: 'finish-start'
50
},
51
{
52
id: 6,
53
name: 'Define the Opportunity',
54
parent: 1,
55
progressValue: 0.27,
56
actualStart: '2000-02-28T08:00',
57
actualEnd: '2000-02-29'
58
}
59
];
60
61
var chart = anychart.ganttProject();
62
63
var toolbar = anychart.ui.ganttToolbar();
64
toolbar.container('container');
65
toolbar.target(chart);
66
67
// Draw gantt toolbar.
68
toolbar.draw();
69
70
chart.data(data, 'as-table');
71
72
chart.container('container');
73
chart.draw();
74
chart.fitAll();
75
76
// Change Lovale to Russian after toolbar creation and draw.
77
anychart.format.outputLocale('ru-ru');
78
79
// Update toolbar's captions according to new locale settings.
80
toolbar.updateLocalizedCaptions();
81
});