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.right(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.bar(data);
20
21
// inverts y scale. Now all elements has inverted (from right to left) direction
22
chart.yScale().inverted(true);
23
24
// inverts x scale. Now all elements has inverted (from top to bottom) direction
25
chart.xScale().inverted(true);
26
27
chart.xAxis().orientation("bottom");
28
chart.yAxis().orientation("left");
29
30
chart.container("container");
31
chart.draw();
32
});