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 chart = anychart.line([6, 10, 18, 11, 9]);
3
chart.yScale().minimum(0);
4
chart.xScale("linear");
5
6
chart.annotations([{
7
type: "ellipse",
8
xAnchor: 1.9,
9
valueAnchor: 17,
10
secondXAnchor: 2.1,
11
secondValueAnchor: 19,
12
fill: "#4CAF50 0.5",
13
stroke: "3 #FF9800"
14
}, {
15
type: "triangle",
16
xAnchor: 2.9,
17
valueAnchor: 10.5,
18
secondXAnchor: 3.1,
19
secondValueAnchor: 10.5,
20
thirdXAnchor: 3,
21
thirdValueAnchor: 12,
22
fill: "#80deea 0.5",
23
stroke: "3 #FFD54F"
24
}]);
25
26
var controller = chart.annotations();
27
28
// Get annotation by index.
29
var annotation = controller.getAnnotationAt(1);
30
31
chart.title("Get and modify annotations by index.");
32
chart.container("container");
33
chart.draw();
34
35
annotation.select();
36
});