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