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
chart.padding(10, 10, 10, 50);
9
10
var plot = chart.plot();
11
plot.line(mapping);
12
13
var triangleAnnotations = chart.annotations();
14
15
chart.title("Start drawing an annotation and click here to cancel drawing.");
16
chart.container("container");
17
chart.draw();
18
19
triangleAnnotations.startDrawing("triangle");
20
21
var title = chart.title();
22
title.listen("click", function () {
23
// Cancel annotation drawing.
24
triangleAnnotations.cancelDrawing();
25
});
26
});