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