• Jun
  • 04
  • 2012
blog-image

Recently I came through a requirement to draw pie chart in an application. I made that application in php.

I searched around and find the best code for drawing pie chart.

<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 11],
['Eat', 2],
['Commute', 2],
['Watch TV', 2],
['Sleep', 7]
]);

var options = {
title: 'My Daily Activities'
};

var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>

You can change the parameters in the code and can get different kinds of results. You can also make this chart 3D.

You can get more reference over this link : Pie chart

Ravi Makhija

Ravi Makhija

A writer, an Entrepreneur. Curious about the internet of everything. Interested in the cutting edge landscape of mobile apps and SAAS products. Blogs for Guru Technolabs - A Mobile App Development Company.

Popular Blogs

recent-blog-image

Among the many digital tools that are being used with…

recent-blog-image

This question is most searched question in google. It is…

recent-blog-image

When you are using WPML in wordpress at that time…

recent-blog-image

Method for linking pages that aren't in a Site Menu…

recent-blog-image

Manier times we come across requirement like fetching/getting content from…

Let's Discuss a Project

Please share your unique idea or project requirement with us, our business concern person will get back to you with further details.