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 plot1 = chart.plot(0);
10
plot1.line(mapping);
11
plot1.annotations([{
12
type: 'rectangle',
13
xAnchor: 1107129600000,
14
valueAnchor: 9000,
15
secondXAnchor: 1131408000000,
16
secondValueAnchor: 12000,
17
fill: '#4CAF50 0.5',
18
stroke: '3 #FF9800'
19
}]);
20
21
var plot2 = chart.plot(1);
22
plot2.area(mapping);
23
plot2.annotations([{
24
type: 'ellipse',
25
xAnchor: 1167782400000,
26
valueAnchor: 11000,
27
secondXAnchor: 1199232000000,
28
secondValueAnchor: 14500,
29
fill: '#4CAF50 0.5',
30
stroke: '3 #FF9800'
31
}]);
32
33
var annotation = chart.annotations();
34
35
// Removes all annotations.
36
annotation.removeAllAnnotations();
37
38
chart.title('Removes all annotations from chart');
39
chart.container('container');
40
chart.draw();
41
});