HTMLcopy
1
<button onclick="shareAsPng();">Get the link to PNG image</button>
2
<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
anychart.onDocumentReady(function() {
3
chart = anychart.surface(getData());
4
chart.title('Share chart as PNG image');
5
chart.container('container');
6
chart.draw();
7
});
8
9
function shareAsPng() {
10
11
// Share chart as PNG image.
12
chart.shareAsPng(function (response) {
13
alert(response);
14
});
15
}
16
17
function getData() {
18
return [
19
[-3, -3, -216],
20
[-3, -2, -125],
21
[-3, -1, -64],
22
[-3, 0, -27],
23
[-3, 1, -8],
24
[-3, 2, -1],
25
[-3, 3, 0],
26
[-2, -3, -125],
27
[-2, -2, -64],
28
[-2, -1, -27],
29
[-2, 0, -8],
30
[-2, 1, -1],
31
[-2, 2, 0],
32
[-2, 3, 1],
33
[-1, -3, -64],
34
[-1, -2, -27],
35
[-1, -1, -8],
36
[-1, 0, -1],
37
[-1, 1, 0],
38
[-1, 2, 1],
39
[-1, 3, 8],
40
[0, -3, -27],
41
[0, -2, -8],
42
[0, -1, -1],
43
[0, 0, 0],
44
[0, 1, 1],
45
[0, 2, 8],
46
[0, 3, 27],
47
[1, -3, -8],
48
[1, -2, -1],
49
[1, -1, 0],
50
[1, 0, 1],
51
[1, 1, 8],
52
[1, 2, 27],
53
[1, 3, 64],
54
[2, -3, -1],
55
[2, -2, 0],
56
[2, -1, 1],
57
[2, 0, 8],
58
[2, 1, 27],
59
[2, 2, 64],
60
[2, 3, 125],
61
[3, -3, 0],
62
[3, -2, 1],
63
[3, -1, 8],
64
[3, 0, 27],
65
[3, 1, 64],
66
[3, 2, 125],
67
[3, 3, 216]
68
]
69
}