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 = getData();
3
4
var chart = anychart.resource();
5
chart.zoomLevel(1);
6
chart.data(data);
7
8
var timeLine = chart.timeLine();
9
10
var timeLineHolidays = timeLine.holidays();
11
12
// Get padding.
13
var paddingSettings = timeLineHolidays.padding();
14
15
paddingSettings.left(5);
16
17
chart.container("container");
18
chart.draw();
19
});
20
function getData() {
21
return [
22
{
23
"name": "Vasil Kiryienka",
24
"description": "Rider",
25
"activities": [
26
{
27
"name": "World Championships",
28
"start": '2016-10-12',
29
"end": '2016-10-12'
30
}
31
]
32
},
33
{
34
"name": "Elia Viviani",
35
"description": "Rider",
36
"activities": [
37
{
38
"name": "Paris - Tours",
39
"start": '2016-10-09',
40
"end": '2016-10-09'
41
},
42
{
43
"name": "World Championships",
44
"start": '2016-10-16',
45
"end": '2016-10-16'
46
},
47
{
48
"name": "Abu Dhabi Tour",
49
"start": '2016-10-20',
50
"end": '2016-10-23'
51
}
52
]
53
},
54
{
55
"name": "Ben Swift",
56
"description": "Rider",
57
"activities": [
58
{
59
"name": "World Championships",
60
"start": '2016-10-09',
61
"end": '2016-10-09'
62
},
63
{
64
"name": "World Championships",
65
"start": '2016-10-16',
66
"end": '2016-10-16'
67
}
68
]
69
},
70
{
71
"name": "Michal Kwiatkowski",
72
"description": "Rider",
73
"activities": [
74
{
75
"name": "World Championships",
76
"start": '2016-10-09',
77
"end": '2016-10-09'
78
},
79
{
80
"name": "Abu Dhabi Tour",
81
"start": '2016-10-20',
82
"end": '2016-10-23'
83
}
84
]
85
},
86
{
87
"name": "Alex Peters",
88
"description": "Rider",
89
"activities": [
90
{
91
"name": "Japan Cup",
92
"start": '2016-10-23',
93
"end": '2016-10-23'
94
}
95
]
96
},
97
{
98
"name": "Ian Stannard",
99
"description": "Rider",
100
"activities": [
101
{
102
"name": "Paris - Tours",
103
"start": '2016-10-09',
104
"end": '2016-10-09'
105
},
106
{
107
"name": "World Championships",
108
"start": '2016-10-16',
109
"end": '2016-10-16'
110
}
111
]
112
},
113
{
114
"name": "Lars Petter Nordhaug",
115
"description": "Rider",
116
"activities": [
117
{
118
"name": "Paris - Tours",
119
"start": '2016-10-09',
120
"end": '2016-10-09'
121
},
122
{
123
"name": "Japan Cup",
124
"start": '2016-10-23',
125
"end": '2016-10-23'
126
}
127
]
128
},
129
{
130
"name": "Nicolas Roche",
131
"description": "Rider",
132
"activities": [
133
{
134
"name": "World Championships",
135
"start": '2016-10-09',
136
"end": '2016-10-09'
137
},
138
{
139
"name": "World Championships",
140
"start": '2016-10-12',
141
"end": '2016-10-12'
142
},
143
{
144
"name": "Abu Dhabi Tour",
145
"start": '2016-10-20',
146
"end": '2016-10-23'
147
}
148
]
149
},
150
{
151
"name": "Geraint Thomas",
152
"description": "Rider",
153
"activities": [
154
{
155
"name": "World Championships",
156
"start": '2016-10-09',
157
"end": '2016-10-09'
158
},
159
{
160
"name": "World Championships",
161
"start": '2016-10-16',
162
"end": '2016-10-16'
163
}
164
]
165
},
166
{
167
"name": "Danny van Poppel",
168
"description": "Rider",
169
"activities": [
170
{
171
"name": "World Championships",
172
"start": '2016-10-09',
173
"end": '2016-10-09'
174
},
175
{
176
"name": "World Championships",
177
"start": '2016-10-16',
178
"end": '2016-10-16'
179
},
180
{
181
"name": "Abu Dhabi Tour",
182
"start": '2016-10-20',
183
"end": '2016-10-23'
184
}
185
]
186
},
187
{
188
"name": "David Lopez",
189
"description": "Rider",
190
"activities": [
191
{
192
"name": "Japan Cup",
193
"start": '2016-10-23',
194
"end": '2016-10-23'
195
}
196
]
197
},
198
{
199
"name": "Xabier Zandio",
200
"description": "Rider",
201
"activities": [
202
{
203
"name": "Japan Cup",
204
"start": '2016-10-23',
205
"end": '2016-10-23'
206
}
207
]
208
}
209
];
210
}