HTMLcopy
1
<div id="container"></div>
2
<div style="position: absolute; top: 325px; right: 25px; width: 90%;">
3
<input style="margin-bottom: 10px;" type="button" value="getSvgBase64String" onclick="getSvgBase64String()">
4
<textarea style="width: 100%;" rows="10" 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
var data = getData();
4
5
chart = anychart.heatMap(data);
6
chart.bottom('50%');
7
chart.title('Returns SVG as base64 string');
8
chart.container('container');
9
chart.draw();
10
});
11
12
function getSvgBase64String() {
13
14
// Get SVG as base64 string.
15
chart.getSvgBase64String(function (response) {
16
var base64String = document.getElementById('getSvgBase64String');
17
base64String.innerHTML = response;
18
});
19
}
20
21
function getData() {
22
return [
23
{x: 'California', y: '2004', heat: 1704211},
24
{x: 'California', y: '2005', heat: 2782680},
25
{x: 'California', y: '2006', heat: 2992679},
26
{x: 'Illinois', y: '2004', heat: 727914},
27
{x: 'Illinois', y: '2005', heat: 1150659},
28
{x: 'Illinois', y: '2006', heat: 1134085},
29
{x: 'Massachusetts', y: '2004', heat: 238819},
30
{x: 'Massachusetts', y: '2005', heat: 157719},
31
{x: 'Massachusetts', y: '2006', heat: 887169},
32
{x: 'New York', y: '2004', heat: 1667969},
33
{x: 'New York', y: '2005', heat: 2763503},
34
{x: 'New York', y: '2006', heat: 3151022},
35
{x: 'Texas', y: '2004', heat: 219967},
36
{x: 'Texas', y: '2005', heat: 3732889},
37
{x: 'Texas', y: '2006', heat: 4185098}
38
]
39
}