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 data table
4
var dataTable = anychart.data.table();
5
6
// add data
7
dataTable.addData([
8
["2014-01-02",92.86,93.05,91.2,91.55,5327800],
9
["2014-01-05",92,93.09,92,93.05,5276300],
10
["2014-01-06",92.2,93.19,92.14,93.06,4380000],
11
["2014-01-07",93.14,93.38,92.47,92.78,4927600],
12
["2014-01-08",93.21,93.21,92.03,93.04,6179800],
13
["2014-01-09",91.75,92.35,91,91.21,7930900],
14
["2014-01-12",91.21,92.14,91.21,91.55,5130400],
15
["2014-01-13",91.45,91.51,89.01,89.7,8842500],
16
["2014-01-14",89.9,90.46,89.75,90.31,5505100],
17
["2014-01-15",95.07,95.65,93.55,94.02,8912000],
18
["2014-01-16",95,95.35,94.71,95.32,5487107],
19
["2014-01-20",96,97.44,95.73,97.1,7233108],
20
["2014-01-21",97.23,98.04,96.64,97.7,6949000],
21
["2014-01-22",97.84,98.16,97.32,97.51,4371600],
22
["2014-01-23",97.82,98.21,97.1,97.9,5283900],
23
["2014-01-26",97.9,99.85,97.56,99.85,6189400],
24
["2014-01-27",99.4,99.67,98.7,98.8,5345300],
25
["2014-01-28",99.15,99.42,97.28,97.38,6549700],
26
["2014-01-29",98.1,98.6,96.55,98.01,6642500],
27
["2014-01-30",98.02,99.33,97.84,99.23,6137600],
28
["2014-02-02",99.15,99.94,98.5,99.39,6200000],
29
["2014-02-03",99,100,98.95,100,5604300],
30
["2014-02-04",99.38,100.43,99.3,100.19,8387500],
31
["2014-02-05",100,100.09,98.26,98.86,5975000],
32
["2014-02-06",98.85,99.24,98.25,98.94,5516900],
33
["2014-02-09",99.31,99.44,98.6,98.95,3742400],
34
["2014-02-10",98.45,99.97,98.41,99.61,4057500],
35
["2014-02-11",99.2,100.31,98.8,99.96,5505700],
36
["2014-02-12",100.06,100.3,99.3,99.3,3611500]
37
]);
38
39
40
// map the data
41
var mapping1 = dataTable.mapAs({"value": 4});
42
var mapping2 = dataTable.mapAs({"value": 5});
43
44
// create stock chart
45
var chart = anychart.stock();
46
47
// create a column series
48
chart.plot(0).column(mapping1);
49
50
// set the range of points shown on the chart
51
chart.selectRange("2014-01-13", "2014-02-04");
52
53
// create a thumbnail series in the scroller
54
var scrollerSeries = chart.scroller().column(mapping2);
55
56
// set the color for the selected columns in the thumbnail series
57
scrollerSeries.selected().fill("#00796B");
58
59
// set container id
60
chart.container("container");
61
62
// initiate drawing the chart
63
chart.draw();
64
});