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: "Slavic Languages", children: [
6
{name: "East Slavic", children: [
7
{name: "Russian", value: 150000000},
8
{name: "Ukrainian", value: 45000000},
9
{name: "Belarusian", value: 3200000}
10
]},
11
{name: "West Slavic", children: [
12
{name: "Polish", value: 55000000},
13
{name: "Czech", value: 10600000},
14
{name: "Slovak", value: 5200000}
15
]},
16
{name: "South Slavic", children: [
17
{name: "Serbo-Croatian", value: 21000000},
18
{name: "Bulgarian", value: 9000000},
19
{name: "Slovene", value: 2500000},
20
{name: "Macedonian", value: 1400000}
21
]}
22
]}
23
];
24
25
// create a chart and set the data
26
var chart = anychart.circlePacking(data, "as-tree");
27
28
// configure the visual settings of the chart
29
chart.normal().fill("#00838f", 0.3);
30
chart.hovered().fill("#dd2c00", 0.1);
31
chart.selected().fill("#dd2c00", 0.3);
32
chart.normal().stroke("#00838f", 1);
33
chart.hovered().stroke("#dd2c00 ", 2);
34
chart.selected().stroke("#dd2c00", 4);
35
36
// set the chart title
37
chart.title().useHtml(true);
38
chart.title("Circle Packing: Appearance (All Points)<br><br>" +
39
"<span style='font-size:12; font-style:italic'>" +
40
"Slavic Languages by Number of Speakers</span>");
41
42
// set the container id
43
chart.container("container");
44
45
// initiate drawing the chart
46
chart.draw();
47
});