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 stage = anychart.graphics.create("container");
3
4
var lineChart = anychart.line([6, 10, 18, 11, 9]);
5
lineChart.yScale().minimum(0);
6
lineChart.bounds(0, 20, "50%", "100%");
7
8
var controller = lineChart.annotations();
9
controller.line({
10
xAnchor: 1,
11
valueAnchor: 11,
12
secondXAnchor: 3,
13
secondValueAnchor: 12,
14
stroke: "2 #F44336"
15
});
16
17
lineChart.container(stage);
18
lineChart.draw();
19
20
21
var columnChart = anychart.column([6, 10, 18, 11, 9]);
22
columnChart.yScale().minimum(0);
23
columnChart.bounds("50%", 20, "50%", "100%");
24
25
// Return plot annotation in JSON object with theme settings.
26
var json = controller.toJson(false, true);
27
28
var annotation = columnChart.annotations();
29
annotation.fromJson(json);
30
31
columnChart.container(stage);
32
columnChart.draw();
33
34
var customTitle = anychart.standalones.title();
35
customTitle.text("Return plot annotation in JSON object with theme settings.");
36
customTitle.container(stage);
37
customTitle.draw();
38
});