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="getPngBase64String" onclick="getPngBase64String()">
4
<textarea style="width: 100%;" rows="5" cols="70" id="getPngBase64String"></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.pareto();
4
chart.data([
5
{x: 'Nail polish', value: 14814},
6
{x: 'Eyebrow pencil', value: 13012},
7
{x: 'Rouge', value: 16624},
8
{x: 'Lipstick', value: 8814},
9
{x: 'Eyeshadows', value: 12998},
10
{x: 'Eyeliner', value: 17321},
11
{x: 'Foundation', value: 10342},
12
{x: 'Lip gloss', value: 22998},
13
{x: 'Mascara', value: 19261}
14
]);
15
chart.margin([0, '45%', 0, 0]);
16
chart.title('Returns PNG as base64 string');
17
chart.container('container');
18
chart.draw();
19
});
20
21
function getPngBase64String() {
22
23
// Get PNG as base64 string
24
chart.getPngBase64String(function (response) {
25
var base64String = document.getElementById('getPngBase64String');
26
base64String.innerHTML = response;
27
});
28
}