<button onclick="saveAsSvg();">Save image</button>
<div id="container"></div>
html, body, #container {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
var chart;
anychart.onDocumentReady(function () {
chart = anychart.sparkline([1.3, 2, 1.4, 4, 2.3, 6]);
chart.title({text: 'Save chart as SVG file with width and height set', orientation: 'top'});
chart.container('container');
chart.draw();
});
function saveAsSvg() {
// Save chart as SVG file
chart.saveAsSvg(400, 300);