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
var data = [
3
{
4
name: 'Eurasia',
5
children: [
6
{
7
name: "Asia", children: [
8
{
9
name: "Eastern Asia", children: [
10
{name: "Mongolia", value: 1564116, capital: 'Ulan-Bator'},
11
{name: "China", value: 1564116, capital: 'Beijing'},
12
{name: "Southern Korea", value: 1564116, capital: 'Seoul'},
13
{name: "Northern Korea", value: 120540, capital: 'Pyongyang'},
14
{name: "Japan", value: 1564116, capital: 'Tokio'}
15
]
16
}
17
]
18
},
19
{
20
name: "Europe", children: [
21
{
22
name: "Northern Europe", children: [
23
{name: "Finland", value: 338424, capital: 'Helsinki'},
24
{name: "Great Britain", value: 209331, capital: 'London'},
25
{name: "Ireland", value: 84421, capital: 'Dublin'},
26
{name: "Scandinavia", value: 928057}
27
]
28
}
29
]
30
}
31
]
32
}
33
];
34
35
var chart = anychart.treeMap(data);
36
37
// Set fill.
38
chart.selectFill(function () {
39
return this.sourceColor + " 0.3";
40
});
41
42
chart.title("Set chart selectFill parameter as a function.");
43
chart.container("container");
44
chart.draw();
45
});