Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application...
-
Upload
abigail-higgins -
Category
Documents
-
view
213 -
download
1
Transcript of Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application...
![Page 1: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/1.jpg)
Google Charts API
Ashwin Neurgaonkar
10/13/2008
![Page 2: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/2.jpg)
What are APIs ?• API stands for ‘Application Programmable
Interface’.
As it’s name implies, it is an interface that queries the Google database to help programmers in the development of their applications.
• Why use them ? Easy access to google`s services
Reduced overhead for developers
• Objective: To understand the basics of Google Charts API.
![Page 3: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/3.jpg)
Basics: Google Chart API
• The URL
http://chart.apis.google.com/chart?<parameter 1>&<parameter 2>&<parameter n>
Refer http://code.google.com/apis/chart/#maps
• http://chart.apis.google.com/chart?chs=250x100 // chart size
&chd=t:60,40 // chart data
&cht=p3 // chart type
&chl=Hello|World // labels
http://chart.apis.google.com/chart?chs=300x150&chd=t:60,40&cht=p3&chl=Hello|World&chtt=This+is+so+cool!
![Page 4: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/4.jpg)
Features
• Several types of charts. (pie/bar/sparklelines/Radar/Venn diagrams etc)
• Options like Range markers/solid fill/linear gradient/linear stripes/labels and legends make the charts look complete and definitive.
• Multiple types of Text encoding.
• Availability! google never fails …
![Page 5: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/5.jpg)
Using API with PHP
• Open source libraries with ready classes available.
• Some useful links:
http://luddep.se/notebook/2008/04/13/charts-php-and-google-charts-api/
http://code.google.com/p/gchartphp/
![Page 6: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/6.jpg)
sample
• <?php
$chart = new googChart();
$chart->setChartAttrs( array(
'type' => 'pie',
'data' => $data,
'size' => array( 300, 200 ) ));
echo $chart;
• <?php
$data = array(
'IE7' => 22,
'IE6' => 30.7,
'IE5' => 1.7,
'Firefox' => 36.5,
'Mozilla' => 1.1,
'Safari' => 2,
'Opera' => 1.4, );
![Page 7: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/7.jpg)
Issues to consider
• Most readily available classes only implement a small subset of available google charts functions.
• Licensing may be a problem.
• Fixing bugs may consume too much time.
• Max size available is 300,000 pixels. i.e maximum sizes are 1000x300, 300x1000,
600x500, 500x600, 800x375, and 375x800.
![Page 8: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/8.jpg)
Licensing
• Google APIs are NOT open source, but free to be used by developers. No licensing issues!
• Third party Implementations/libraries/classes for Google API maybe open source hence, licensing issues must be considered.
![Page 9: Google Charts API Ashwin Neurgaonkar 10/13/2008. What are APIs ? API stands for ‘Application Programmable Interface’. As it’s name implies, it is an interface.](https://reader035.fdocuments.in/reader035/viewer/2022072005/56649f415503460f94c609fb/html5/thumbnails/9.jpg)
Some interesting uage
• Thematic mapping using google API http://themechanism.com/blog/2008/03/30/thematic-
mapping-with-the-google-charts-api-a-brief-tutorial/
• Generating charts from tables http://icant.co.uk/sandbox/datatable-to-chart/
• Using the Google Chart API with Microsoft Excel
http://www.tushar-mehta.com/publish_train/xl_vba_cases/excel_google_chart_api/index.htm