HTMLcopy
1
<script src="https://cdn.anychart.com/releases/8.10.0/js/anychart-core.min.js"></script>
2
<script src="https://cdn.anychart.com/releases/8.10.0/js/anychart-pie.min.js"></script>
3
<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
3
// add data
4
var data = anychart.data.set([
5
['Spotify', 34],
6
['Apple Music', 21],
7
['Amazon Music', 15],
8
['Tencent apps', 11],
9
['YouTube Music', 6],
10
['Others', 13]
11
]);
12
13
// create a pie chart with the data
14
var chart = anychart.pie(data)
15
16
// set the chart radius making a donut chart
17
chart.innerRadius('55%');
18
19
// set the chart title
20
chart.title('Music Streaming Apps Global Market Share')
21
22
// set container id for the chart
23
chart.container('container');
24
25
// initiate chart drawing
26
chart.draw();
27
28
});