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 chart
4
var chart = anychart.cartesian();
5
6
var margin = chart.margin();
7
margin.top(30);
8
margin.left(30);
9
10
// data
11
var data = [
12
["A", 4],
13
["B", 3],
14
["C", 2],
15
["D", 1]
16
];
17
18
// add series
19
chart.column(data);
20
21
// position of y axis changer. Now y is on the right
22
chart.yAxis().orientation("right");
23
24
// inverts y scale. Now all elements has inverted (from right to left) direction
25
chart.yScale().inverted(true);
26
27
// inverts x scale. Now all elements has inverted (from top to bottom) direction
28
chart.xScale().inverted(true);
29
30
// set x axis position. This position is set by default
31
chart.xAxis().orientation("bottom");
32
33
chart.container("container");
34
chart.draw();
35
});