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
3
// add the data
4
let data = anychart.data.set([
5
["Chennai Super Kings", 5],
6
["Mumbai Indians", 5],
7
["Kolkatta Knight Riders", 2],
8
["Deccan Chargers", 1],
9
["Gujarat Titans", 1],
10
["Rajasthan Royal", 1],
11
["Sunrisers Hyderabad", 1],
12
]);
13
14
// create a pie chart with the data
15
let chart = anychart.pie(data);
16
17
// set the chart title
18
chart.title("IPL Winnership Over 16 Seasons");
19
20
// set container id for the chart
21
chart.container("container");
22
23
// initiate chart drawing
24
chart.draw();
25
26
});