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
var controller = chart.annotations();
13
14
var annotation = controller.finiteTrendChannel();
15
16
// Set X anchor.
17
annotation.xAnchor(1.3);
18
19
// Set value anchor.
20
annotation.valueAnchor(13.5);
21
22
// Set second X anchor.
23
annotation.secondXAnchor(2);
24
25
// Set second value anchor.
26
annotation.secondValueAnchor(19);
27
28
// Set channel width.
29
annotation.channelWidth(-2);
30
31
chart.title('Set anchors and channel width settings');
32
chart.container('container');
33
chart.draw();
34
});