Pie Chart

HTML

<canvas id="canvaspiechart" width="300" height="300"></canvas>

JavaScript

canvas = document.getElementById('canvaspiechart'); 
ctx = canvas.getContext('2d'); 
 
var cx = 150; 
var cy = 150; 
 
function toRadians(deg) { 
return deg * Math.PI / 180 
} 
 
function drawpiechart() { 
 
ctx.fillStyle='#fdbb30'; 
ctx.beginPath(); 
ctx.moveTo(cx,cy); 
ctx.arc(cx,cy,125,0,toRadians(65.4545454545)); 
ctx.lineTo(cx,cy); 
ctx.closePath(); 
ctx.fill();  
 
ctx.fillStyle='#0087dc'; 
ctx.beginPath(); 
ctx.moveTo(cx,cy); 
ctx.arc(cx,cy,125,toRadians(65.4545454545),toRadians(98.1818181818)); 
ctx.lineTo(cx,cy); 
ctx.closePath(); 
ctx.fill();  
 
ctx.fillStyle='#EEEEEE'; 
ctx.beginPath(); 
ctx.moveTo(cx,cy); 
ctx.arc(cx,cy,125,toRadians(46),toRadians(360)); 
ctx.lineTo(cx,cy); 
ctx.closePath(); 
ctx.fill();  

}

drawpiechart()