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
3
// create a chart
4
var chart = anychart.column();
5
6
//create series
7
var series = chart.column(getData());
8
series.name("Total support requests");
9
10
var xZoom = chart.xZoom();
11
12
// enable the scroller
13
chart.xScroller(true);
14
15
// set listener on chart
16
chart.listen("pointClick", function(e) {
17
e.series.excludePoint(e.pointIndex);
18
xZoom.setToPointsCount(15);
19
});
20
21
// change the scroller orientation
22
chart.xScroller().allowRangeChange(false);
23
24
// Zooms series by defined points count.
25
xZoom.setToPointsCount(15);
26
27
// autoHide the scroller
28
chart.xScroller().autoHide("true");
29
30
// define chart settings
31
chart.xAxis().title("Hours");
32
chart.yAxis().title("Support requests");
33
chart.title("Amount of support requests by hours");
34
35
// display a chart
36
chart.container("container");
37
chart.draw();
38
});
39
40
function getData(){
41
return [
42
["00:00", 10],
43
["01:00", 4],
44
["02:00", 17],
45
["03:00", 20],
46
["04:00", 20],
47
["05:00", 16],
48
["06:00", 35],
49
["07:00", 6],
50
["08:00", 15],
51
["09:00", 19],
52
["10:00", 25],
53
["11:00", 34],
54
["12:00", 42],
55
["13:00", 14],
56
["14:00", 50],
57
["15:00", 25],
58
["16:00", 34],
59
["17:00", 40],
60
["18:00", 64],
61
["19:00", 48],
62
["20:00", 22],
63
["21:00", 37],
64
["22:00", 53],
65
["23:00", 62]
66
];
67
}