HTMLcopy
1
<button onclick="chart.saveAsPng()">Save as PNG</button>
2
<div id="container"></div>
CSScopy
9
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
button {
8
margin: 10px 0 0 10px;
9
}
JavaScriptcopy
x
1
var chart;
2
anychart.onDocumentReady(function () {
3
chart = anychart.line([
4
{x: 'January', value: 6},
5
{x: 'February', value: 48},
6
{x: 'March', value: 6},
7
{x: 'April', value: 44},
8
{x: 'May', value: 8},
9
{x: 'June', value: 29},
10
{x: 'July', value: 9},
11
{x: 'August', value: 23},
12
{x: 'September', value: 9},
13
{x: 'October', value: 17},
14
{x: 'November', value: 17},
15
{x: 'December', value: 17}
16
]);
17
18
chart.title('Set client side export settings');
19
20
// Set client side export settings.
21
anychart.exports.clientside({
22
'path': 'https://cdn.anychart.com/3rd/', // path to dependencies
23
'enabled': true, // clientside export enabled
24
'fallback': true // fallback to server side exporting
25
});
26
27
chart.container('container');
28
chart.draw();
29
});