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 chart = anychart.line();
3
4
// enable the scroller
5
chart.xScroller(true);
6
7
// Zooms series by defined points count.
8
chart.xZoom().setToPointsCount(10, true);
9
10
// create a series
11
var series = chart.column(getData());
12
series.name("New users");
13
14
chart.xAxis().title("Month");
15
chart.yAxis().title("New users");
16
chart.title("New internet users \nLimit the shown points' number to 10");
17
18
19
chart.container("container");
20
chart.draw();
21
});
22
23
function getData(){
24
return [
25
["Jan 15", 2094],
26
["Feb 15", 1865],
27
["Mar 15", 2051],
28
["Apr 15", 2301],
29
["May 15", 1509],
30
["Jun 15", 1044],
31
["Jul 15", 1935],
32
["Aug 15", 2109],
33
["Sep 15", 2002],
34
["Oct 15", 1609],
35
["Nov 15", 1634],
36
["Dec 15", 2403],
37
["Jan 16", 2105],
38
["Feb 16", 2844],
39
["Mar 16", 2523],
40
["Apr 16", 2766],
41
["May 16", 1985],
42
["Jun 16", 1646],
43
["Jul 16", 934],
44
["Aug 16", 1104],
45
["Sep 16", 1824],
46
["Oct 16", 1534],
47
["Nov 16", 1911],
48
["Dec 16", 2323]
49
];
50
};