HTMLcopy
1
<button onclick="rotationY();">Rotate -20 degrees</button>
2
<button onclick="defaultAngle()">Default angle</button>
3
<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
var chart;
2
3
function rotationY() {
4
5
// Set rotational angle by the Y axis.
6
chart.rotationY(-20);
7
}
8
9
function defaultAngle() {
10
chart.rotationY(35);
11
}
12
anychart.onDocumentReady(function() {
13
chart = anychart.surface(getData());
14
chart.yAxis({title: 'Y-axis'});
15
chart.title('Rotate the chart -20 degrees by the Y axis');
16
chart.container('container');
17
chart.draw();
18
});
19
20
function getData() {
21
return [
22
[-3, -3, -216],
23
[-3, -2, -125],
24
[-3, -1, -64],
25
[-3, 0, -27],
26
[-3, 1, -8],
27
[-3, 2, -1],
28
[-3, 3, 0],
29
[-2, -3, -125],
30
[-2, -2, -64],
31
[-2, -1, -27],
32
[-2, 0, -8],
33
[-2, 1, -1],
34
[-2, 2, 0],
35
[-2, 3, 1],
36
[-1, -3, -64],
37
[-1, -2, -27],
38
[-1, -1, -8],
39
[-1, 0, -1],
40
[-1, 1, 0],
41
[-1, 2, 1],
42
[-1, 3, 8],
43
[0, -3, -27],
44
[0, -2, -8],
45
[0, -1, -1],
46
[0, 0, 0],
47
[0, 1, 1],
48
[0, 2, 8],
49
[0, 3, 27],
50
[1, -3, -8],
51
[1, -2, -1],
52
[1, -1, 0],
53
[1, 0, 1],
54
[1, 1, 8],
55
[1, 2, 27],
56
[1, 3, 64],
57
[2, -3, -1],
58
[2, -2, 0],
59
[2, -1, 1],
60
[2, 0, 8],
61
[2, 1, 27],
62
[2, 2, 64],
63
[2, 3, 125],
64
[3, -3, 0],
65
[3, -2, 1],
66
[3, -1, 8],
67
[3, 0, 27],
68
[3, 1, 64],
69
[3, 2, 125],
70
[3, 3, 216]
71
]
72
}