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.surface(getData());
3
chart.title('Get chart as SVG with predefined paper size and orientation');
4
chart.container('container');
5
chart.draw();
6
7
// Get chart as SVG with parameters.
8
var SVGstring = chart.toSvg('a4', true);
9
// Now you can do something with this string, send it to the server and etc.
10
});
11
function getData() {
12
return [
13
[-3, -3, -216],
14
[-3, -2, -125],
15
[-3, -1, -64],
16
[-3, 0, -27],
17
[-3, 1, -8],
18
[-3, 2, -1],
19
[-3, 3, 0],
20
[-2, -3, -125],
21
[-2, -2, -64],
22
[-2, -1, -27],
23
[-2, 0, -8],
24
[-2, 1, -1],
25
[-2, 2, 0],
26
[-2, 3, 1],
27
[-1, -3, -64],
28
[-1, -2, -27],
29
[-1, -1, -8],
30
[-1, 0, -1],
31
[-1, 1, 0],
32
[-1, 2, 1],
33
[-1, 3, 8],
34
[0, -3, -27],
35
[0, -2, -8],
36
[0, -1, -1],
37
[0, 0, 0],
38
[0, 1, 1],
39
[0, 2, 8],
40
[0, 3, 27],
41
[1, -3, -8],
42
[1, -2, -1],
43
[1, -1, 0],
44
[1, 0, 1],
45
[1, 1, 8],
46
[1, 2, 27],
47
[1, 3, 64],
48
[2, -3, -1],
49
[2, -2, 0],
50
[2, -1, 1],
51
[2, 0, 8],
52
[2, 1, 27],
53
[2, 2, 64],
54
[2, 3, 125],
55
[3, -3, 0],
56
[3, -2, 1],
57
[3, -1, 8],
58
[3, 0, 27],
59
[3, 1, 64],
60
[3, 2, 125],
61
[3, 3, 216]
62
]
63
}