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.bar();
5
6
// define zoom settings
7
chart.xZoom().setToPointsCount(10);
8
9
// enable and configure the scroller
10
chart.xScroller(true);
11
chart.xScroller().orientation("left");
12
chart.xScroller().thumbs(false);
13
14
// prevent the range changing
15
chart.xScroller().allowRangeChange(false);
16
17
var data = [
18
["Facebook", 9245],
19
["Live", 7345],
20
["MSN", 10522],
21
["Youtube", 12034],
22
["Yahoo", 9014],
23
["Wikipedia", 13463],
24
["Google", 10525],
25
["Baidu", 6345],
26
["Twitter", 10211],
27
["Amazon", 8093],
28
["Ebay", 7836],
29
["LinkedIn", 7276],
30
["Vk", 9463],
31
["Instagram", 10876],
32
["TMall", 7220],
33
["Microsoft", 8965],
34
["AliExpress", 9120],
35
["AnyChart", 9246],
36
["PayPal", 6837],
37
["BBC", 5046],
38
["NicoVideo", 6822]
39
];
40
41
//create series
42
var series = chart.bar(data);
43
44
series.name("Unique visitors");
45
46
chart.xAxis().title("Sites");
47
chart.yAxis().title("Users");
48
chart.title("Daily unique visitors \nRange Change prevented");
49
50
chart.container("container");
51
chart.draw();
52
});