Reader Level:

Pie Chart By Google Chart Tools in PHP

By Vinod Kumar on Apr 26, 2013
In this article I show how to create a Pie Chart using Google Chart Tools in PHP.


In this article I show how to create a Pie Chart using Google Chart Tools in PHP. You can create a simple chart using Google Chart Tools. This is a very simple and provides a perfect way to visualize data on your website. The chart is exposed as JavaScript classes and all charts are populated with data using a common JavaScript data table class.  The Google Chart Tool provides many types of charts. You can easily create a chart to fit the look and feel of your site. The Google Chart Tool is a very interesting way to create a chart.




   <!--Load the AJAX API-->

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

   <script type="text/JavaScript">

       // Load the Visualization API and the pie chart package.

       google.load('visualization', '1.0', { 'packages': ['corechart'] });

       // Callback to run when the Google Visualization API is loaded.


       // Callback that creates and populates a data table,

       // instantiates the pie chart, passes in the data and draws it.

       function PieChart() {

           // Creating the chart data.

           var data = new google.visualization.DataTable();

           data.addColumn('String', 'topping');

           data.addColumn('Number', 'slices');


                  ['Analyzer', 3],

                  ['Designer', .5],

                  ['Coder', 1],

                  ['Tester', 1],

                  ['Company', 4],

                  ['Maintenance', .5],


           // You can set chart title and height, width

           var options = {

               'title': 'How many salaries should pay of software developers?',

               'width': 500,

               'height': 400


           // Instantiate and draw our chart, passing in some options.

           var chart = new google.visualization.PieChart(document.getElementById('chart_div'));

           chart.draw(data, options);





    <!--Div that will hold the pie chart-->

   <div id="chart_div"></div>





pie chart.jpg


Vinod  Kumar
Vinod Kumar

       Hi every one I am MCA qualified from IGNOU, Currently working as a Senior software Engineer at dogSpot pvt ltd gurgaon having 3+ year experience and also like web designing ... Read more



JetBrains ReSharper Ultimate
.NET code analysis, refactorings, navigation, unit testing, code coverage and profiling in Visual Studio, a bonus for C++ devs, bundled at 50% off.

Trending up

Infragistics jQuery Controls