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
chart.annotations([{
12
type: 'ellipse',
13
xAnchor: 1.9,
14
valueAnchor: 17,
15
secondXAnchor: 2.1,
16
secondValueAnchor: 19,
17
fill: '#673AB7 0.5',
18
stroke: '3 #FF9800'
19
}]);
20
21
var annotation = chart.annotations().getAnnotationAt(0);
22
23
// Get X-scale.
24
var scale = annotation.xScale();
25
scale.inverted(true);
26
27
chart.title('Get and modify X-scale');
28
chart.container('container');
29
chart.draw();
30
});