.


Divya

How to create a google pie chart in HTML


<!DOCTYPE html>
<html lang="en-US">
<body>
<div id="piechart"></div>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load google charts
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
// Draw the chart and set the chart values
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Page visit per Day'],
['PHP', 8],
['JAVA', 8],
['SQL', 4],
['Wordpress', 2],
['JSP', 2]
]);
// Optional; add a title and set the width and height of the chart
var options = {'title':'My Average page visit per Day', 'width':550, 'height':400};
// Display the chart inside the <div> element with id="piechart"
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
</script>
</body>
</html>


.