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/edit-controls-styling/data.json
4
anychart.data.loadJsonFile(
5
'https://cdn.anychart.com/samples/gantt-live-editing/edit-controls-styling/data.json',
6
function (data) {
7
// create data tree on raw data
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
// make chart editable
17
chart.edit(true);
18
19
// set pixel position of the main splitter
20
chart.splitterPosition(220);
21
22
// coloring the data grid's edit controls
23
chart.dataGrid().edit().fill('red 0.3').stroke('red');
24
25
// coloring the data grid's placement stroke
26
chart.dataGrid().edit().placementStroke({
27
color: 'black',
28
dash: '5 2',
29
thickness: 2
30
});
31
32
// get timeline
33
var timeline = chart.getTimeline();
34
35
// coloring the timeline's edit controls
36
timeline.connectors().previewStroke('3 green 0.3');
37
38
timeline.elements().edit().fill('black 0.2').stroke('3 blue 0.8');
39
40
// coloring the intervals editing controls
41
timeline
42
.elements()
43
.edit()
44
.thumbs()
45
.fill('red')
46
.stroke('black')
47
.size(10); // set width of the intervals editing controls
48
49
// set task progress settings
50
timeline.tasks().progress().edit().fill('yellow').stroke('2 black');
51
52
// set connector thumbs settings
53
timeline
54
.elements()
55
.edit()
56
.connectorThumbs()
57
.fill('#9f9')
58
.stroke('#090');
59
60
// set the appearance control edit to start connector
61
timeline
62
.elements()
63
.edit()
64
.start()
65
.connectorThumb()
66
.type('triangleleft')
67
.size(15) // set marker size
68
.horizontalOffset(1); // set horizontal offset
69
70
// set the appearance control edit to finish connector
71
timeline
72
.elements()
73
.edit()
74
.end()
75
.connectorThumb()
76
.type('triangleright')
77
.size(15) // set marker size
78
.horizontalOffset(-1); // set horizontal offset
79
80
// set container id for the chart
81
chart.container('container');
82
83
// initiate chart drawing
84
chart.draw();
85
86
// zoom chart all dates range
87
chart.fitAll();
88
}
89
);
90
});