HTMLcopy
1
<div id="container"></div>
2
<div style="position: absolute; top: 40px; right: 25px; width: 31%;">
3
<input style="margin-bottom: 10px;" type="button" value="getSvgBase64String" onclick="getSvgBase64String()">
4
<textarea style="width: 100%;" rows="5" cols="70" id="getSvgBase64String"></textarea>
5
</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.sparkline([1.3, 2, 1.4, 4, 2.3, 6]);
4
chart.title({text: 'Returns SVG as base64 string', orientation: 'top'});
5
chart.container('container');
6
chart.draw();
7
});
8
9
function getSvgBase64String() {
10
11
// Get PNG as base64 string
12
chart.getSvgBase64String(function (response) {
13
var base64String = document.getElementById('getSvgBase64String');
14
base64String.innerHTML = response;
15
});
16
}