MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.

I'm not curious

How to draw pie chart?

Published on 10 August 18
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.


<script type="text/javascript" src=""></script>

<script type="text/javascript">

google.load("visualization", "1", {packages:["corechart"]});


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);





<div id="chart_div" style="width: 900px; height: 500px;"></div>


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
Helpful Links:
This blog is listed under Development & Implementations Community

Related Posts:
Post a Comment

Please notify me the replies via email.

  • We hope the conversations that take place on will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
Awards & Accolades for MyTechLogy
Winner of
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url