HTMLcopy
1
<button onclick="chart.shareWithFacebook();">Share with Facebook</button>
2
<div id="container"></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
7
// To work with exports you need to reference the exports module from AnyChart CDN
8
// (https://cdn.anychart.com/releases/8.13.0/js/anychart-exports.min.js for latest or https://cdn.anychart.com/releases/8.13.0/js/anychart-exports.min.js for the versioned file)
9
10
// Set exports settings.
11
chart.exports({facebook: {caption: 'ANYCHART.COM', description: 'HeatMap chart'}});
12
13
chart.title('Set exports settings');
14
chart.container('container');
15
chart.draw();
16
});
17
18
function getData() {
19
return [
20
{x: 'California', y: '2004', heat: 1704211},
21
{x: 'California', y: '2005', heat: 2782680},
22
{x: 'California', y: '2006', heat: 2992679},
23
{x: 'Illinois', y: '2004', heat: 727914},
24
{x: 'Illinois', y: '2005', heat: 1150659},
25
{x: 'Illinois', y: '2006', heat: 1134085},
26
{x: 'Massachusetts', y: '2004', heat: 238819},
27
{x: 'Massachusetts', y: '2005', heat: 157719},
28
{x: 'Massachusetts', y: '2006', heat: 887169},
29
{x: 'New York', y: '2004', heat: 1667969},
30
{x: 'New York', y: '2005', heat: 2763503},
31
{x: 'New York', y: '2006', heat: 3151022},
32
{x: 'Texas', y: '2004', heat: 219967},
33
{x: 'Texas', y: '2005', heat: 3732889},
34
{x: 'Texas', y: '2006', heat: 4185098}
35
]
36
}