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
3
// create a chart
4
var chart = anychart.scatter();
5
6
//set min and max axis
7
chart.yScale().minimum(0);
8
chart.yScale().maximum(100);
9
10
11
chart.xScale().minimum(0);
12
chart.xScale().maximum(100);
13
14
//creating an annotations controller
15
var controller = chart.annotations();
16
17
// Create rectangle annotation 1
18
var area1 = controller.rectangle({
19
xAnchor: 0, //bottom left point
20
valueAnchor: 0, //bottom right point
21
secondXAnchor: 30, //top left point
22
secondValueAnchor: 30, //top right point
23
allowEdit: false,
24
color: "#aaaa0055",
25
26
});
27
28
// Create rectangle annotation 1
29
var area2 = controller.rectangle({
30
xAnchor: 30, //bottom left point
31
valueAnchor: 30, //bottom right point
32
secondXAnchor: 100, //top left point
33
secondValueAnchor: 100, //top right point
34
allowEdit: false,
35
color: "#00aaaa55",
36
});
37
38
39
// set the container id
40
chart.container("container");
41
chart.draw();
42
});