HTMLcopy
1
<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
anychart.onDocumentReady(function() {
2
// create treemap chart
3
var chart = anychart.treeMap(data);
4
5
// disable drilldown
6
chart.listen(anychart.enums.EventType.DRILL_CHANGE, function(e) {
7
return false;
8
});
9
10
// set title
11
chart.title("2012 Export Map");
12
13
var data = [
14
{id: 'Europe', parent: null},
15
{id: 'Eastern Europe', parent: 'Europe'},
16
{id: 'Western Europe', parent: 'Europe'},
17
{id: 'Southern Europe', parent: 'Europe'},
18
{id: 'Northern Europe', parent: 'Europe'},
19
{id: 'Poland', parent: 'Eastern Europe', value: 312679},
20
{id: 'Ukraine', parent: 'Eastern Europe', value: 603628},
21
{id: 'Austria', parent: 'Western Europe', value: 83879},
22
{id: 'Germany', parent: 'Western Europe', value: 357168},
23
{id: 'France', parent: 'Western Europe', value: 643801},
24
{id: 'Malta', parent: 'Southern Europe', value: 316},
25
{id: 'Greece', parent: 'Southern Europe', value: 131957},
26
{id: 'Italy', parent: 'Southern Europe', value: 301338},
27
{id: 'Finland', parent: 'Northern Europe', value: 338424},
28
{id: 'Great Britain', parent: 'Northern Europe', value: 209331},
29
{id: 'Ireland', parent: 'Northern Europe', value: 84421},
30
{id: 'Scandinavia', parent: 'Northern Europe', value: 928057},
31
{id: 'Sweden', parent: 'Scandinavia', value: 450295, capital: 'Stockholm'},
32
{id: 'Norway', parent: 'Scandinavia', value: 385178, capital: 'Oslo'},
33
{id: 'Denmark', parent: 'Scandinavia', value: 42923.53, capital: 'Copenhagen'}
34
];
35
36
// set data to chart
37
chart.data(data, anychart.enums.TreeFillingMethod.AS_TABLE);
38
39
// display chart
40
chart.container('container');
41
chart.draw();
42
});