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
// create a chart
3
var chart = anychart.line();
4
5
// enable the scroller
6
chart.xScroller(true);
7
8
var xZoom = chart.xZoom();
9
10
// zoom to a number of points.
11
xZoom.setToPointsCount(6);
12
13
var startRatio = xZoom.getStartRatio();
14
var endRatio = xZoom.getEndRatio();
15
16
// get the limits ratio
17
chart.title("The chart shows the part from " + startRatio + " and ends " + endRatio);
18
19
20
//create series
21
var series = chart.line(getData());
22
series.name("Total support requests");
23
24
chart.xAxis().title("Hours");
25
chart.yAxis().title("Support requests");
26
chart.title("Amount of support requests by hours");
27
28
chart.container("container");
29
chart.draw();
30
});
31
32
// get data function
33
function getData(){
34
return [
35
["00:00", 10],
36
["01:00", 4],
37
["02:00", 17],
38
["03:00", 20],
39
["04:00", 20],
40
["05:00", 16],
41
["06:00", 35],
42
["07:00", 6],
43
["08:00", 15],
44
["09:00", 19],
45
["10:00", 25],
46
["11:00", 34],
47
["12:00", 42],
48
["13:00", 14],
49
["14:00", 50],
50
["15:00", 25],
51
["16:00", 34],
52
["17:00", 40],
53
["18:00", 64],
54
["19:00", 48],
55
["20:00", 22],
56
["21:00", 37],
57
["22:00", 53],
58
["23:00", 62]
59
];
60
}