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
plot.annotations([{
13
enabled: true,
14
type: 'ellipse',
15
xAnchor: '2007-04-01',
16
valueAnchor: 14060,
17
secondXAnchor: '2008-03-02',
18
secondValueAnchor: 12522
19
}
20
]);
21
22
// Set event type.
23
// Select an annotation and change the title on the event.
24
chart.listen('annotationSelect', function () {
25
return chart.title('The annotation is selected')
26
});
27
28
// Set event type.
29
// Deselect an annotation and change the title on the event.
30
chart.listen('annotationUnselect', function () {
31
return chart.title('The annotation is deselected')
32
});
33
34
chart.title('Select an annotation/Deselect a selected annotation');
35
chart.container('container');
36
chart.draw();
37
});