HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
anychart.data.loadJsonFile('https://gist.githubusercontent.com/shacheeswadia/17dc3b3d4ac9b63ac5ac6833944f3a94/raw/07c4bec103d22ec2824453a33d41868fd476db3d/dataPackedCircles.json',
3
function(data) {
4
5
// set data
6
var treeData = anychart.data.tree(data, 'as-table');
7
8
// create a circle packing chart instance
9
var chart = anychart.circlePacking(treeData);
10
11
// customize colors:
12
// design theme
13
anychart.theme('darkGlamour');
14
// background
15
chart.background('#333');
16
// fill
17
chart.fill('#333');
18
// stroke
19
chart.stroke(function () {
20
return {
21
thickness: 2,
22
color: this.sourceColor
23
};
24
});
25
26
// add a chart title and customize it
27
chart
28
.title()
29
.enabled(true)
30
.useHtml(true)
31
.text(
32
'<span style = "color: #fff; font-size:20px;">Top 100 Most Streamed Songs On Spotify By Genre</span>' +
33
'<br/><span style="color:#1db954; font-size: 18px;">(based on the number of Spotify streams.)</span>'
34
);
35
36
chart.container('container');
37
chart.draw();
38
39
}
40
);
41
});