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 data table on loaded data
4
var dataTable = anychart.data.table();
5
dataTable.addData(getData());
6
7
// map loaded data
8
var mapping = dataTable.mapAs({'value': 1});
9
10
// create stock chart
11
var chart = anychart.stock();
12
13
// disable scroller
14
chart.scroller().enabled(false);
15
16
// add a series
17
chart.plot(0).line(mapping);
18
19
// adjust the title according to scroller
20
chart.title("Turn the scroller off");
21
22
// set container id for the chart
23
chart.container('container');
24
25
// initiate chart drawing
26
chart.draw();
27
});
28
29
function getData(){
30
return [
31
['2004-01-02', 2011.08],
32
['2004-01-05', 2020.78],
33
['2004-01-06', 2044.55],
34
['2004-01-07', 2056.75],
35
['2004-01-08', 2089.60],
36
['2004-01-09', 2083.63],
37
['2004-01-12', 2093.54],
38
['2004-01-13', 2113.11],
39
['2004-01-14', 2104.29],
40
['2004-01-15', 2101.86],
41
['2004-01-16', 2126.12],
42
['2004-01-20', 2149.03],
43
['2004-01-21', 2139.33],
44
['2004-01-22', 2146.32],
45
['2004-01-23', 2124.76],
46
['2004-01-26', 2120.56],
47
['2004-01-27', 2148.05],
48
['2004-01-28', 2125.02],
49
['2004-01-29', 2085.54],
50
['2004-01-30', 2068.36]
51
];
52
}