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