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 dataTable = anychart.data.table();
3
dataTable.addData(get_dji_daily_short_data());
4
5
var mapping = dataTable.mapAs({value: 1});
6
7
var chart = anychart.stock();
8
9
var plot = chart.plot();
10
plot.line(mapping);
11
12
var rangeSelector = anychart.ui.rangeSelector();
13
14
// Set ranges for range selector.
15
rangeSelector.ranges([{
16
'text': 'Vacation 2006',
17
'startDate': '2006 May 16',
18
'endDate': '2006 Jul 29'
19
}, {
20
'text': 'Vacation 2007',
21
'startDate': '2007 Feb 1',
22
'endDate': '2007 Mar 8'
23
}, {
24
'text': 'Vacation 2008',
25
'startDate': '2008 Oct 15',
26
'endDate': '2008 Nov 4'
27
}, {
28
'type': "Unit",
29
'unit': "Day",
30
'count': 10,
31
'anchor': "firstDate",
32
'text': "10 DAYS"
33
}, {
34
'type': "Unit",
35
'unit': "quarter",
36
'count': 2,
37
'anchor': "firstDate",
38
'text': "6 MONTHS"
39
}, {
40
'type': "Unit",
41
'unit': "year",
42
'count': 2,
43
'anchor': "lastDate",
44
'text': "2 YEARS"
45
}]);
46
47
chart.title("Set ranges for range selector");
48
chart.container("container");
49
chart.draw();
50
51
rangeSelector.render(chart);
52
});