SlideShare a Scribd company logo
1 of 26
Introduction to the Google Visualization API Jason Young, NC State University June 8, 2009
What's all this about? Visualization, API, Google, Introduction
Visualization For now, let's just say that's a Fancy word for "graph"
Our Example Visualization Ooooooh, a Live Demo!
Application  Programming  Interface i.e. Why use excel when you can spend 100s of hours coding the very same thing?
<?php      $title = &quot;Time Jason Spent Preparing For This Presentation&quot;;      $width = 800;      $height = 600;      $diameter = 400;      $center_xpos = 300;      $center_ypos = 300;      $width_label = 10;           $data_values = array(80,10,10);      $data_labels = array(&quot;Joking about it on twitter&quot;,&quot;Writing code&quot;,&quot;Presenting to my dogs&quot;);           $mygraph = ImageCreate( $width, $height );           $color[] = ImageColorAllocate( $mygraph, 255, 102, 102 ); //red      $color[] = ImageColorAllocate( $mygraph, 102, 255, 102 ); //green      $color[] = ImageColorAllocate( $mygraph, 102, 102, 255 ); //blue      $white = ImageColorAllocate( $mygraph, 255, 255, 255 );      $black = ImageColorAllocate( $mygraph, 0, 0, 0 );      ImageFill( $mygraph, 0, 0, $white );           $slice_current = 0;      for( $i = 0; $i < count( $data_values ); $i++ ) {          $slice_start = round( $slice_current );          $slice_current += ( $data_values[ $i ] / 100 ) * 360;          $slice_end = round( $slice_current );                   $slice_color = $color[$i];                   ImageArc( $mygraph, $center_xpos, $center_ypos, $diameter, $diameter, $slice_start, $slice_current, $slice_color );                   # start          $arc_xpos = cos(deg2rad($slice_start)) * ($diameter / 2);          $arc_ypos = sin(deg2rad($slice_start)) * ($diameter / 2);          ImageLine( $mygraph, $center_xpos, $center_ypos, floor( $center_xpos + $arc_xpos ), floor( $center_ypos + $arc_ypos ), $slice_color );                   # end          $arc_xpos = cos(deg2rad($slice_end)) * ($diameter / 2);          $arc_ypos = sin(deg2rad($slice_end)) * ($diameter / 2);          ImageLine( $mygraph, $center_xpos, $center_ypos, ceil( $center_xpos + $arc_xpos ), ceil( $center_ypos + $arc_ypos ), $slice_color );                   # fill          $slice_mid = round( ( ( $slice_end - $slice_start ) / 2 ) + $slice_start );          $arc_xpos = cos(deg2rad($slice_mid)) * ($diameter / 3);          $arc_ypos = sin(deg2rad($slice_mid)) * ($diameter / 3);          ImageFillToBorder( $mygraph, floor( $center_xpos + $arc_xpos ), floor( $center_ypos + $arc_ypos ), $slice_color, $slice_color );      }           $label_xpos = $center_xpos + $diameter / 2 + 10;      $label_ypos = $center_ypos - $diameter / 4;      $title_xpos = $center_xpos - $diameter / 4;      $title_ypos = 0; #$center_ypos - $diameter / 2;      ImageString( $mygraph, 15, $title_xpos, $title_ypos, $title, $black );           for( $i = 0; $i < count( $data_labels ); $i++ ) {          $label_color = $color[$i];          ImageFilledRectangle( $mygraph, $label_xpos + 1, $label_ypos + 1, $label_xpos + $width_label, $label_ypos + $width_label, $label_color );          ImageString( $mygraph, 10, $label_xpos + $width_label + 5, $label_ypos, $data_labels[ $i ], $black );          ImageString( $mygraph, 10, $label_xpos + $width_label + 250, $label_ypos, $data_values[ $i ], $black );          $label_ypos += $width_label + 2;      }           ImageString( $mygraph, 11, $label_xpos, $label_ypos, &quot;Total:&quot;, $black );      ImageString( $mygraph, 11, $label_xpos + $width_label + 250, $label_ypos, 100, $black );      Header( &quot;Content-type: image/PNG&quot; );      ImagePNG( $mygraph );      ImageDestroy( $mygraph );      ?>
$title  = &quot;Time Jason Spent Preparing For This Presentation&quot;; $data_values  =  array (80,10,10); $data_labels  =  array (&quot;Joking about it on twitter&quot;, &quot;Writing code&quot;,&quot;Presenting to my dogs&quot;); $mygraph  =  ImageCreate (  $width ,  $height  ); $color[]  =  ImageColorAllocate (  $mygraph , 255, 102, 102 ); [...]  ImageArc (  $mygraph ,  $center_xpos ,  $center_ypos ,  $diameter ,  $diameter ,  $slice_start ,  $slice_current ,  $slice_color  ); [...] ImageLine (  $mygraph ,  $center_xpos ,  $center_ypos ,  floor (  $center_xpos  +  $arc_xpos  ),  floor (  $center_ypos  +  $arc_ypos  ),  $slice_color  ); [...] Header ( &quot;Content-type: image/PNG&quot; ); ImagePNG (  $mygraph  );
 
Story Time
Google http://code.google.com/apis/visualization/
OMG!  It's Javascript?!?
Introduction finally!
<html>   <head>     <!--Load the AJAX API-->     <script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;></script>     <script type=&quot;text/javascript&quot;>            // Load the Visualization API and the piechart package.       google.load('visualization', '1', {'packages':['piechart']});              // Set a callback to run when the API is loaded.       google.setOnLoadCallback(drawChart);              // Callback that creates and populates a data table, instantiates the pie chart, passes in the data and draws it.       function drawChart() {         var data = new google.visualization.DataTable();         data.addColumn('string', 'Activity');         data.addColumn('number', 'Percentage of Time Spent');         data.addRows(3);         data.setValue(0, 0, 'Joking about it on twitter');         data.setValue(0, 1, 80);         data.setValue(1, 0, 'Writing code');         data.setValue(1, 1, 10);         data.setValue(2, 0, 'Presenting to my dogs');         data.setValue(2, 1, 10);         var chart = new google.visualization.PieChart(document.getElementById('chart_div'));         chart.draw(data, {width: 800, height: 600, is3D: true, title: 'Time Jason Spent Preparing For This Presentation'});       }     </script>   </head>   <body>     <!--Div that will hold the pie chart-->     <div id=&quot;chart_div&quot;></div>   </body> </html>
Codexploration ,[object Object],[object Object],[object Object],[object Object],[object Object]
Codexploration ,[object Object],[object Object]
Codexploration ,[object Object],[object Object],[object Object]
Codexploration ,[object Object]
JavaScript Object Notation (JSON) ,[object Object],[object Object]
A Live example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
<html> <head>     <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;/>     <title>Hourly Activity - eXtension People</title>     <script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;></script>     <script type=&quot;text/javascript&quot;>       google.load(&quot;visualization&quot;, &quot;1&quot;, {packages:[&quot;columnchart&quot;]});              google.setOnLoadCallback(queryData);          function queryData() {       var query = new google.visualization.Query('https://people.extension.org/data/activitytable?activity=aaeresolve&tz=US%2FEastern');       query.send(handleQueryResponse);     }    function handleQueryResponse(response) {       if (response.isError()) {         alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());         return;       }       var data = response.getDataTable();     var chart = new google.visualization.ColumnChart(document.getElementById('visualization_chart'));     chart.draw(data, {width: 800, height: 480, legend: 'bottom', title: ''});   } </script> </head>      <body>             <h1>Hourly Activity</h1> <div id=&quot;visualization_chart&quot;></div> </body> </html>
Codexploration ,[object Object]
Codexploration ,[object Object],[object Object],[object Object]
 
iGoogle  
More... putting the visualization back into &quot;graph&quot;
Questions? finally. No, really.

More Related Content

What's hot

Why Hacking WordPress Search Isn't Some Big Scary Thing
Why Hacking WordPress Search Isn't Some Big Scary ThingWhy Hacking WordPress Search Isn't Some Big Scary Thing
Why Hacking WordPress Search Isn't Some Big Scary ThingChris Reynolds
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom fieldIvan Zugec
 
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Axway Appcelerator
 
The Art of Transduction
The Art of TransductionThe Art of Transduction
The Art of TransductionDavid Stockton
 
Comparing 30 MongoDB operations with Oracle SQL statements
Comparing 30 MongoDB operations with Oracle SQL statementsComparing 30 MongoDB operations with Oracle SQL statements
Comparing 30 MongoDB operations with Oracle SQL statementsLucas Jellema
 
Gareth hayes. non alphanumeric javascript-php and shared fuzzing
Gareth hayes. non alphanumeric javascript-php and shared fuzzingGareth hayes. non alphanumeric javascript-php and shared fuzzing
Gareth hayes. non alphanumeric javascript-php and shared fuzzingYury Chemerkin
 
Everything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askEverything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askAndrea Giuliano
 
Coding Horrors
Coding HorrorsCoding Horrors
Coding HorrorsMark Baker
 
Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Peter Meyer
 
Javascript & jQuery: A pragmatic introduction
Javascript & jQuery: A pragmatic introductionJavascript & jQuery: A pragmatic introduction
Javascript & jQuery: A pragmatic introductionIban Martinez
 
Extending Moose
Extending MooseExtending Moose
Extending Moosesartak
 
PHP webboard
PHP webboardPHP webboard
PHP webboardtumetr1
 
Code moi une RH! (PHP tour 2017)
Code moi une RH! (PHP tour 2017)Code moi une RH! (PHP tour 2017)
Code moi une RH! (PHP tour 2017)Arnaud Langlade
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Kris Wallsmith
 
PHP cart
PHP cartPHP cart
PHP carttumetr1
 
WordPress 3.1 at DC PHP
WordPress 3.1 at DC PHPWordPress 3.1 at DC PHP
WordPress 3.1 at DC PHPandrewnacin
 
HTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherHTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherIvano Malavolta
 

What's hot (20)

Why Hacking WordPress Search Isn't Some Big Scary Thing
Why Hacking WordPress Search Isn't Some Big Scary ThingWhy Hacking WordPress Search Isn't Some Big Scary Thing
Why Hacking WordPress Search Isn't Some Big Scary Thing
 
Fields in Core: How to create a custom field
Fields in Core: How to create a custom fieldFields in Core: How to create a custom field
Fields in Core: How to create a custom field
 
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
Wynn Netherland: Accelerating Titanium Development with CoffeeScript, Compass...
 
The Art of Transduction
The Art of TransductionThe Art of Transduction
The Art of Transduction
 
Comparing 30 MongoDB operations with Oracle SQL statements
Comparing 30 MongoDB operations with Oracle SQL statementsComparing 30 MongoDB operations with Oracle SQL statements
Comparing 30 MongoDB operations with Oracle SQL statements
 
Gareth hayes. non alphanumeric javascript-php and shared fuzzing
Gareth hayes. non alphanumeric javascript-php and shared fuzzingGareth hayes. non alphanumeric javascript-php and shared fuzzing
Gareth hayes. non alphanumeric javascript-php and shared fuzzing
 
SVGo workshop
SVGo workshopSVGo workshop
SVGo workshop
 
Everything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askEverything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to ask
 
Coding Horrors
Coding HorrorsCoding Horrors
Coding Horrors
 
Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018
 
Javascript & jQuery: A pragmatic introduction
Javascript & jQuery: A pragmatic introductionJavascript & jQuery: A pragmatic introduction
Javascript & jQuery: A pragmatic introduction
 
Extending Moose
Extending MooseExtending Moose
Extending Moose
 
Emmet cheat-sheet
Emmet cheat-sheetEmmet cheat-sheet
Emmet cheat-sheet
 
PHP webboard
PHP webboardPHP webboard
PHP webboard
 
Code moi une RH! (PHP tour 2017)
Code moi une RH! (PHP tour 2017)Code moi une RH! (PHP tour 2017)
Code moi une RH! (PHP tour 2017)
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)
 
PHP cart
PHP cartPHP cart
PHP cart
 
WordPress 3.1 at DC PHP
WordPress 3.1 at DC PHPWordPress 3.1 at DC PHP
WordPress 3.1 at DC PHP
 
HTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherHTML5 and CSS3 Refresher
HTML5 and CSS3 Refresher
 
#ThisIsHappening
#ThisIsHappening#ThisIsHappening
#ThisIsHappening
 

Similar to Google Visualization API

Drupal Lightning FAPI Jumpstart
Drupal Lightning FAPI JumpstartDrupal Lightning FAPI Jumpstart
Drupal Lightning FAPI Jumpstartguestfd47e4c7
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)Jeff Eaton
 
Perl使いの国のRubyist
Perl使いの国のRubyistPerl使いの国のRubyist
Perl使いの国のRubyistTakafumi ONAKA
 
Oh, you’re the NY times guy
Oh, you’re the NY times guyOh, you’re the NY times guy
Oh, you’re the NY times guyDavid Hayes
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With PhpJeremy Coates
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB jhchabran
 
Graph Databases
Graph DatabasesGraph Databases
Graph DatabasesJosh Adell
 
Scripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptScripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptJustin Deoliveira
 
London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)Dennis Knochenwefel
 
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdfphp global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdfanjalitimecenter11
 
jQuery - Doing it right
jQuery - Doing it rightjQuery - Doing it right
jQuery - Doing it rightgirish82
 

Similar to Google Visualization API (20)

Drupal Lightning FAPI Jumpstart
Drupal Lightning FAPI JumpstartDrupal Lightning FAPI Jumpstart
Drupal Lightning FAPI Jumpstart
 
JQuery Basics
JQuery BasicsJQuery Basics
JQuery Basics
 
Jquery
JqueryJquery
Jquery
 
Drupal Development (Part 2)
Drupal Development (Part 2)Drupal Development (Part 2)
Drupal Development (Part 2)
 
Perl使いの国のRubyist
Perl使いの国のRubyistPerl使いの国のRubyist
Perl使いの国のRubyist
 
Oh, you’re the NY times guy
Oh, you’re the NY times guyOh, you’re the NY times guy
Oh, you’re the NY times guy
 
Views notwithstanding
Views notwithstandingViews notwithstanding
Views notwithstanding
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 
Faking Data
Faking DataFaking Data
Faking Data
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
 
Convidar para page !!
Convidar para page !!Convidar para page !!
Convidar para page !!
 
Graph Databases
Graph DatabasesGraph Databases
Graph Databases
 
Theme verdadeiro
Theme verdadeiroTheme verdadeiro
Theme verdadeiro
 
Database api
Database apiDatabase api
Database api
 
Wp meetup custom post types
Wp meetup custom post typesWp meetup custom post types
Wp meetup custom post types
 
Scripting GeoServer with GeoScript
Scripting GeoServer with GeoScriptScripting GeoServer with GeoScript
Scripting GeoServer with GeoScript
 
Php
PhpPhp
Php
 
London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)London XQuery Meetup: Querying the World (Web Scraping)
London XQuery Meetup: Querying the World (Web Scraping)
 
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdfphp global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
php global $bsize,$playerToken,$myToken,$gameOver,$winArr,$rowAr.pdf
 
jQuery - Doing it right
jQuery - Doing it rightjQuery - Doing it right
jQuery - Doing it right
 

Recently uploaded

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Google Visualization API

  • 1. Introduction to the Google Visualization API Jason Young, NC State University June 8, 2009
  • 2. What's all this about? Visualization, API, Google, Introduction
  • 3. Visualization For now, let's just say that's a Fancy word for &quot;graph&quot;
  • 4. Our Example Visualization Ooooooh, a Live Demo!
  • 5. Application Programming  Interface i.e. Why use excel when you can spend 100s of hours coding the very same thing?
  • 6. <?php      $title = &quot;Time Jason Spent Preparing For This Presentation&quot;;      $width = 800;      $height = 600;      $diameter = 400;      $center_xpos = 300;      $center_ypos = 300;      $width_label = 10;           $data_values = array(80,10,10);      $data_labels = array(&quot;Joking about it on twitter&quot;,&quot;Writing code&quot;,&quot;Presenting to my dogs&quot;);           $mygraph = ImageCreate( $width, $height );           $color[] = ImageColorAllocate( $mygraph, 255, 102, 102 ); //red      $color[] = ImageColorAllocate( $mygraph, 102, 255, 102 ); //green      $color[] = ImageColorAllocate( $mygraph, 102, 102, 255 ); //blue      $white = ImageColorAllocate( $mygraph, 255, 255, 255 );      $black = ImageColorAllocate( $mygraph, 0, 0, 0 );      ImageFill( $mygraph, 0, 0, $white );           $slice_current = 0;      for( $i = 0; $i < count( $data_values ); $i++ ) {          $slice_start = round( $slice_current );          $slice_current += ( $data_values[ $i ] / 100 ) * 360;          $slice_end = round( $slice_current );                   $slice_color = $color[$i];                   ImageArc( $mygraph, $center_xpos, $center_ypos, $diameter, $diameter, $slice_start, $slice_current, $slice_color );                   # start          $arc_xpos = cos(deg2rad($slice_start)) * ($diameter / 2);          $arc_ypos = sin(deg2rad($slice_start)) * ($diameter / 2);          ImageLine( $mygraph, $center_xpos, $center_ypos, floor( $center_xpos + $arc_xpos ), floor( $center_ypos + $arc_ypos ), $slice_color );                   # end          $arc_xpos = cos(deg2rad($slice_end)) * ($diameter / 2);          $arc_ypos = sin(deg2rad($slice_end)) * ($diameter / 2);          ImageLine( $mygraph, $center_xpos, $center_ypos, ceil( $center_xpos + $arc_xpos ), ceil( $center_ypos + $arc_ypos ), $slice_color );                   # fill          $slice_mid = round( ( ( $slice_end - $slice_start ) / 2 ) + $slice_start );          $arc_xpos = cos(deg2rad($slice_mid)) * ($diameter / 3);          $arc_ypos = sin(deg2rad($slice_mid)) * ($diameter / 3);          ImageFillToBorder( $mygraph, floor( $center_xpos + $arc_xpos ), floor( $center_ypos + $arc_ypos ), $slice_color, $slice_color );      }           $label_xpos = $center_xpos + $diameter / 2 + 10;      $label_ypos = $center_ypos - $diameter / 4;      $title_xpos = $center_xpos - $diameter / 4;      $title_ypos = 0; #$center_ypos - $diameter / 2;      ImageString( $mygraph, 15, $title_xpos, $title_ypos, $title, $black );           for( $i = 0; $i < count( $data_labels ); $i++ ) {          $label_color = $color[$i];          ImageFilledRectangle( $mygraph, $label_xpos + 1, $label_ypos + 1, $label_xpos + $width_label, $label_ypos + $width_label, $label_color );          ImageString( $mygraph, 10, $label_xpos + $width_label + 5, $label_ypos, $data_labels[ $i ], $black );          ImageString( $mygraph, 10, $label_xpos + $width_label + 250, $label_ypos, $data_values[ $i ], $black );          $label_ypos += $width_label + 2;      }           ImageString( $mygraph, 11, $label_xpos, $label_ypos, &quot;Total:&quot;, $black );      ImageString( $mygraph, 11, $label_xpos + $width_label + 250, $label_ypos, 100, $black );      Header( &quot;Content-type: image/PNG&quot; );      ImagePNG( $mygraph );      ImageDestroy( $mygraph );      ?>
  • 7. $title = &quot;Time Jason Spent Preparing For This Presentation&quot;; $data_values = array (80,10,10); $data_labels = array (&quot;Joking about it on twitter&quot;, &quot;Writing code&quot;,&quot;Presenting to my dogs&quot;); $mygraph = ImageCreate ( $width , $height ); $color[] = ImageColorAllocate ( $mygraph , 255, 102, 102 ); [...]  ImageArc ( $mygraph , $center_xpos , $center_ypos , $diameter , $diameter , $slice_start , $slice_current ,  $slice_color ); [...] ImageLine ( $mygraph , $center_xpos , $center_ypos ,  floor ( $center_xpos + $arc_xpos ),  floor ( $center_ypos + $arc_ypos ), $slice_color ); [...] Header ( &quot;Content-type: image/PNG&quot; ); ImagePNG ( $mygraph );
  • 8.  
  • 13. <html>   <head>     <!--Load the AJAX API-->     <script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;></script>     <script type=&quot;text/javascript&quot;>           // Load the Visualization API and the piechart package.       google.load('visualization', '1', {'packages':['piechart']});             // Set a callback to run when the API is loaded.       google.setOnLoadCallback(drawChart);             // Callback that creates and populates a data table, instantiates the pie chart, passes in the data and draws it.       function drawChart() {         var data = new google.visualization.DataTable();         data.addColumn('string', 'Activity');         data.addColumn('number', 'Percentage of Time Spent');         data.addRows(3);         data.setValue(0, 0, 'Joking about it on twitter');         data.setValue(0, 1, 80);         data.setValue(1, 0, 'Writing code');         data.setValue(1, 1, 10);         data.setValue(2, 0, 'Presenting to my dogs');         data.setValue(2, 1, 10);         var chart = new google.visualization.PieChart(document.getElementById('chart_div'));         chart.draw(data, {width: 800, height: 600, is3D: true, title: 'Time Jason Spent Preparing For This Presentation'});       }     </script>   </head>   <body>     <!--Div that will hold the pie chart-->     <div id=&quot;chart_div&quot;></div>   </body> </html>
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. <html> <head>     <meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;/>     <title>Hourly Activity - eXtension People</title>     <script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;></script>     <script type=&quot;text/javascript&quot;>       google.load(&quot;visualization&quot;, &quot;1&quot;, {packages:[&quot;columnchart&quot;]});             google.setOnLoadCallback(queryData);         function queryData() {       var query = new google.visualization.Query('https://people.extension.org/data/activitytable?activity=aaeresolve&tz=US%2FEastern');       query.send(handleQueryResponse);     }   function handleQueryResponse(response) {       if (response.isError()) {         alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());         return;       }       var data = response.getDataTable();     var chart = new google.visualization.ColumnChart(document.getElementById('visualization_chart'));     chart.draw(data, {width: 800, height: 480, legend: 'bottom', title: ''});   } </script> </head>     <body>            <h1>Hourly Activity</h1> <div id=&quot;visualization_chart&quot;></div> </body> </html>
  • 21.
  • 22.
  • 23.  
  • 25. More... putting the visualization back into &quot;graph&quot;