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
3
// create data
4
var data = [
5
{name: "European Union", children: [
6
{name: "Belgium", value: 11443830, fill: "#ffcc00"},
7
{name: "France", value: 64938716, fill: "#ff6600"},
8
{name: "Greece", value: 10892931, fill: "#ffcc00"},
9
{name: "Italy", value: 59797978, fill: "#ff6600"},
10
{name: "Netherlands", value: 17032845, fill: "#ffcc00"},
11
{name: "Poland", value: 38563573, fill: "#ff9933"},
12
{name: "Romania", value: 19237513, fill: "#ffcc00"},
13
{name: "Spain", value: 46070146, fill: "#ff9933"},
14
{name: "United Kingdom", value: 65511098, fill: "#ff6600"},
15
{name: "Germany", value: 80636124,
16
normal: {fill: "#ff0000", stroke: "4 #b30059"},
17
hovered: {fill: "#ff0000", stroke: "5 white"},
18
selected: {fill: "#b30059", stroke: "5 white"}
19
}
20
]}
21
];
22
23
// create a chart and set the data
24
var chart = anychart.treeMap(data, "as-tree");
25
26
// set the chart title
27
chart.title().useHtml(true);
28
chart.title("Treemap: Appearance (Individual Points)<br><br>" +
29
"<span style='font-size:12; font-style:italic'>" +
30
"Top 10 European Union Countries by Population</span>");
31
32
// set the container id
33
chart.container("container");
34
35
// initiate drawing the chart
36
chart.draw();
37
});