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_weather_data());
4
5
var mapping = dataTable.mapAs({value: 2});
6
7
var selectable = mapping.createSelectable();
8
var searchResult = selectable.search(1195603200000, 'nearest');
9
10
// Get item index.
11
var index = searchResult.getIndex();
12
13
var chart = anychart.stock();
14
15
var plot = chart.plot();
16
plot.line(mapping);
17
18
chart.title('The item index is ' + index);
19
chart.container('container');
20
chart.draw();
21
});