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.scatter([
3
{x: 3, value: 6},
4
{x: 1, value: 10},
5
{x: 2, value: 18},
6
{x: 3, value: 11},
7
{x: 3.1, value: 10},
8
{x: 3.1, value: 12},
9
{x: 4, value: 9},
10
{x: 2, value: 5},
11
{x: 4.5, value: 7},
12
{x: 2.1, value: 8}
13
]);
14
15
// Set annotations settings.
16
chart.annotations([{
17
type: 'rectangle',
18
xAnchor: 2.9,
19
valueAnchor: 13,
20
secondXAnchor: 3.2,
21
secondValueAnchor: 9,
22
fill: '#4CAF50 0.5',
23
stroke: '2 #FF9800'
24
}, {
25
type: 'ellipse',
26
xAnchor: 3.8,
27
valueAnchor: 10.5,
28
secondXAnchor: 4.7,
29
secondValueAnchor: 6,
30
fill: '#80deea 0.5',
31
stroke: '2 #FFD54F'
32
}]);
33
34
chart.title('Set annotations settings');
35
chart.container('container');
36
chart.draw();
37
});