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
var xScroller = chart.xScroller();
7
8
// enable the scroller
9
xScroller.enabled(true);
10
11
// autoHide the scroller
12
xScroller.autoHide("true");
13
14
// set the fill color
15
xScroller.fill("#33CC33");
16
17
// set the selected fill color
18
xScroller.selectedFill("#339966");
19
20
// set the stroke of the bar
21
xScroller.outlineStroke("#33CC33");
22
23
// set the bar height
24
xScroller.minHeight(5);
25
26
// set the bar height
27
xScroller.maxHeight(35);
28
29
// define zoom settings
30
chart.xZoom().setToPointsCount(15);
31
32
// create a series
33
var series = chart.column(getData());
34
series.name("Total support requests");
35
36
// create a chart settings
37
chart.xAxis().title("Hours");
38
chart.yAxis().title("Support requests");
39
chart.title("Amount of support requests by hours");
40
41
// display a chart
42
chart.container("container");
43
chart.draw();
44
});
45
46
// get data function
47
function getData(){
48
return [
49
["00:00", 10],
50
["01:00", 4],
51
["02:00", 17],
52
["03:00", 20],
53
["04:00", 20],
54
["05:00", 16],
55
["06:00", 35],
56
["07:00", 6],
57
["08:00", 15],
58
["09:00", 19],
59
["10:00", 25],
60
["11:00", 34],
61
["12:00", 42],
62
["13:00", 14],
63
["14:00", 50],
64
["15:00", 25],
65
["16:00", 34],
66
["17:00", 40],
67
["18:00", 64],
68
["19:00", 48],
69
["20:00", 22],
70
["21:00", 37],
71
["22:00", 53],
72
["23:00", 62]
73
]
74
}