Google chart API

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Google chart API

Post by klevis miho »

Has anyone used google charts api?

If yes, and if you know how to work with it, what am I doing wrong in displaying the Y-axis:

http://chart.apis.google.com/chart?chxs ... est6|Test7
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Google chart API

Post by Darhazer »

You can go http://code.google.com/intl/bg-BG/apis/ ... izard.html, paste your URL and play with the editor
In your case you have to add the chxr param - axes range.
thecodewall
Forum Commoner
Posts: 33
Joined: Sun Dec 26, 2010 8:37 am

Re: Google chart API

Post by thecodewall »

Hi! I use Google Chart for my web application, here's my simple code, you can use this as your guide.

Code: Select all

<html> 
  <head> 
    <script type="text/javascript" src="http://www.google.com/jsapi"></script> 
    <script type="text/javascript"> 
      google.load("visualization", "1", {packages:["columnchart"]}); 
      google.setOnLoadCallback(drawChart); 

      function drawChart() { 
        var data = new google.visualization.DataTable(); 
       	data.addColumn('string', 'Course'); 
	data.addColumn('number', 'AB'); 
	data.addColumn('number', 'ABCO'); 
	data.addColumn('number', 'ABID'); 
	data.addColumn('number', 'ABMC'); 
	data.addColumn('number', 'ABPO');
        data.addRows(1); 
        data.setValue(0, 1, 179); 
        data.setValue(0, 2, 78); 
        data.setValue(0, 3, 291); 
        data.setValue(0, 4, 34); 
        data.setValue(0, 5, 101); 

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); 
        chart.draw(data, {width: 400, height: 250, is3D: true, legend: 'right', logScale:false}); 
      } 

    </script> 

  </head> 
  <body style="padding:0px; margin:0px;">
    <div id="chart_div" align="center"></div> 
  </body> 
</html>
Post Reply