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 currentPlot = chart.plot();
10
currentPlot.line(mapping);
11
12
var rangeSelector = anychart.ui.rangeSelector();
13
14
// Set custom ranges for range selector.
15
rangeSelector.ranges([{
16
'text': 'Year 2006',
17
'startDate': '2006 Jan 1',
18
'endDate': '2006 Dec 31'
19
}, {
20
'text': 'Year 2007',
21
'startDate': '2007 Jan 1',
22
'endDate': '2007 Dec 31'
23
}, {
24
'text': 'Full Range',
25
'type': 'max'
26
}]);
27
28
chart.title("Set custom ranges for range selector");
29
chart.container("container");
30
chart.draw();
31
32
rangeSelector.render(chart);
33
});