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.treeMap(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: 'TreeMap chart'}});
12
13
chart.title('Set exports settings');
14
chart.container('container');
15
chart.draw();
16
});
17
18
function getData() {
19
return [
20
{
21
name: 'Eurasia',
22
children: [
23
{
24
name: 'Asia', children: [
25
{
26
name: 'Eastern Asia', children: [
27
{name: 'Mongolia', value: 1564116, capital: 'Ulan-Bator'},
28
{name: 'China', value: 1564116, capital: 'Beijing'},
29
{name: 'Southern Korea', value: 1564116, capital: 'Seoul'},
30
{name: 'Northern Korea', value: 120540, capital: 'Pyongyang'},
31
{name: 'Japan', value: 1564116, capital: 'Tokio'}
32
]
33
}
34
]
35
},
36
{
37
name: 'Europe', children: [
38
{
39
name: 'Northern Europe', children: [
40
{name: 'Finland', value: 338424, capital: 'Helsinki'},
41
{name: 'Great Britain', value: 209331, capital: 'London'},
42
{name: 'Ireland', value: 84421, capital: 'Dublin'},
43
{name: 'Scandinavia', value: 928057}
44
]
45
}
46
]
47
}
48
]
49
}
50
];
51
}