SlideShare uma empresa Scribd logo
1 de 49
Baixar para ler offline
Charting with
                    Google

Thursday, March 24, 2011
http://bit.ly/googlechartlinks
                    Follow along with a list of all the links mentioned




Thursday, March 24, 2011
Russell Heimlich (Like the Maneuver)
          ★ Sole Developer at the
                  Pew Research Center

          ★ 3 Years at U.S.News
                  & World Report

          ★ Creator of
                  Dummyimage.com

          ★ Left handed!

Thursday, March 24, 2011
How Can Google Help Us Make Charts?
          ★ DataTable Object
          ★ Interactive Charts
                  (Visualization API)

          ★ Image Charts
                  (Chart API)




Thursday, March 24, 2011
Getting Started
                                  You have to start somewhere...




                           http://www.flickr.com/photos/npobre/2601582256/


Thursday, March 24, 2011
Load Some Libraries
           <!--Load the AJAX API-->
           <script src="http://www.google.com/jsapi"></script>


           <script type="text/javascript">
           // Load the Visualization API and the piechart package.
           google.load('visualization', '1', {'packages':['corechart']});

               
           // Set a callback to run when everything is loaded.
           google.setOnLoadCallback(drawChart);

           function drawChart() {
              // MAGIC!
           }
           </script>

Thursday, March 24, 2011
DataTable Object
                            Like a database in JavaScript




Thursday, March 24, 2011
What is a DataTable?
          ★ Representation of your data in JavaScript
          ★ Query just like SQL
          ★ Sortable, Filterable, Cloneable, Manipulatable
          ★ Easy to pass along to different visualizations




Thursday, March 24, 2011
Making a DataTable
           var data = new google.visualization.DataTable();

           data.addColumn('string', 'Task');
           data.addColumn('number', 'Hours');

           data.addRows([
             ['Work', 11],
             ['Eat', 1],
             ['Commute', 2],
             ['Watch TV', 3]
           ]);




Thursday, March 24, 2011
More Ways To Populate Data
           // Create and populate the data table.
             var data = new google.visualization.DataTable();
             data.addColumn('string', 'Task');
             data.addColumn('number', 'Hours per Day');
             
              data.addRows(4);
             
              data.setValue(0, 0, 'Work'); //row index, cell index, value
             data.setValue(0, 1, 11);
             data.setValue(1, 0, 'Eat');
             data.setValue(1, 1, 1);
             data.setValue(2, 0, 'Commute');
             data.setValue(2, 1, 2);
             data.setValue(3, 0, 'Watch TV');
             data.setValue(3, 1, 3);



Thursday, March 24, 2011
Which Looks Like This

                            Task         Hours
                             Work          11


                             Eat           1


                           Commute         2


                           Watch TV        3


Thursday, March 24, 2011
DataViews
          ★ Subset of data from a DataTable
          ★ Remove or duplicate rows or columns
          ★ Original DataTable stays intact
          ★ Live view of the underlying data, not a copy




Thursday, March 24, 2011
Making A DataView
           var view = new google.visualization.DataView(data);

           view.setRows(
              view.getFilteredRows([{
                  column:1,
                  maxValue:5
              }])
           );




Thursday, March 24, 2011
Our DataView Now Looks Like This

                            Task        Hours

                             Eat           1


                           Commute         2


                           Watch TV        3


Thursday, March 24, 2011
Building Interactive Charts
                           Getting Nitty Gritty




Thursday, March 24, 2011
Let’s Make A Pie Chart
            // Create and draw the visualization.
           var target = document.getElementById('visualization');
           new google.visualization.PieChart(target).draw(
              view,
              {title: ‘So, how was your day?’}
           );




Thursday, March 24, 2011
And Play With Different Properties
           new google.visualization.PieChart(target).draw(
              view,
              {
                title: ‘So, how was your day?’,
                is3D: true,
                colors: ['#0099ff', '#00ff99', '#9900ff']
              }
           );




Thursday, March 24, 2011
Putting It All Together: Music Age Demo
          ★ Scrape data from an
                  HTML table and put it
                  into a DataTable

          ★ Dynamically create a
                  legend for choosing
                  what to graph

          ★ Make line graphs and
                  bar charts from
                  selected data points
Thursday, March 24, 2011
Table Scrapin’ Fun
           var tableHeaders = $('table th');
           var tableData = $('table tbody tr');
           data = new google.visualization.DataTable();

           for (i=0; i<tableHeaders.length; i++) {
                var cell = tableHeaders[i].innerHTML;
                var cellType = 'number';
                if (i==0) {
                   cellType = 'string';
                }
                data.addColumn(cellType, cell);
           }




Thursday, March 24, 2011
More Table Scrapin’ Fun
           for (i=0; i<tableData.length; i++) {
                var row = $(tableData[i]).children();
                var rowData = new Array();
                for (j=0; j<row.length; j++) {
                   var cell = row[j].innerHTML;
                   if (!cell.match(/[a-zA-Z_.-?!+]/)) {
                       cell = Number(cell)
                   }
                   rowData.push(cell);
                }
                data.addRow(rowData);
           }




Thursday, March 24, 2011
Preppin’ The View
           var artists = $('#legend li');
           var selectedArtists = [0];

           $('table .on').removeClass('on');
           $('table tr').children(':nth-child(1)').addClass('on');

           for (i=0; i<artists.length; i++) {
                if (!$(artists[i]).hasClass('off')) {
                   selectedArtists.push(i+1);
                   $('table tr').children(
                       ':nth-child('+ (i+2) +')'
                    ).addClass('on');
                }
           }

           var view = new google.visualization.DataView(data);
           view.setColumns(selectedArtists);
Thursday, March 24, 2011
Drawin’ The Line Chart
           $('#line').html('');
           var lineChart = new google.visualization.LineChart(
              document.getElementById('line')
           );

           lineChart.draw(view, {
               width: 500,
               height: 350,
               enableTooltip: true,
               showCategories: true,
               legend: 'none',
               max: 75,
               pointSize: 5
           });




Thursday, March 24, 2011
Drawin’ The Bar Chart
           $('#bar').html('');
           var chart = new google.visualization.ColumnChart(
              document.getElementById('bar')
           );

           chart.draw(view, {
               width: 500,
               height: 350,
               enableTooltip: true,
               showCategories: true,
               legend: 'none',
               max: 75,
               is3D: true
           });




Thursday, March 24, 2011
Constructing Static Charts
                           Time to put your thinking cap on




Thursday, March 24, 2011
What is the Google Chart API?
           “The Google Chart API lets you dynamically
           generate charts with a URL string. You can embed
           these charts on your web page, or download the
           image for local or offline use.”


           –– Google Chart Documentation




Thursday, March 24, 2011
Build a URL,
                           Get a Chart

Thursday, March 24, 2011
What types of charts can you make?




Thursday, March 24, 2011
Every Chart Starts With A URL
           http://chart.googleapis.com/chart?



           Parameters come after the question mark
           separated by ampersands (&)


           The order of parameters doesn’t matter




Thursday, March 24, 2011
Requires 3 Things
          ★ Chart Type (cht=<chart type>)
          ★ Chart Size (chs=<width>x<height>)
          ★ Data (chd=<data string>)



          ★ http://chart.googleapis.com/chart?
                  cht=p3&chs=250x100&chd=t:60,40


Thursday, March 24, 2011
Data Formats
          ★ Basic Text Format (chd=t:)
          ★ Simple Encoding (chd=s:)
          ★ Extended Encoding (chd=e:)


          ★ Some formats use less characters than others.




Thursday, March 24, 2011
Basic Text Data Format
          ★ Floating Point Values From 0-100
          ★ Values less than 0 are considered NULL
          ★ Values higher than 100 are truncated to 100
          ★ What you see is what you get
          ★ Ideal for smaller datasets
          ★ Produces the largest number of characters



Thursday, March 24, 2011
Basic Text Data Example
          ★ chd=t:_30,-30,50,80,200




Thursday, March 24, 2011
Simple Encoding Data Format
          ★ Integer values 0-61
          ★ Relative Scaling
          ★ Low Granularity
          ★ Each value encoded as a single alphanumeric
                  character
          ★ Produces the smallest number of characters



Thursday, March 24, 2011
Simple Encoding Function
           var simpleEncoding =
           'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'

           //Scales submitted values so that maxVal becomes the highest.
           function simpleEncode(valueArray, maxValue) {
               var chartData = ['s:'];
               for (var i = 0; i < valueArray.length; i++) {
                 var currentValue = valueArray[i];
                 if (!isNaN(currentValue) && currentValue >= 0) {
                   chartData.push(simpleEncoding.charAt(
                   Math.round((simpleEncoding.length-1) *
                   currentValue / maxValue))
                 ); }
                 else { chartData.push('_'); }
               }
               return chartData.join('');
           }
Thursday, March 24, 2011
Simple Encoding Example
          ★ chd=t:1,19,27,53,61,-1|12,39,57,45,51,27
          ★ chd=s:BTb19_,Mn5tzb




Thursday, March 24, 2011
Extended Data Format
          ★ Integer values 0-4095
          ★ Relative scaling
          ★ High Granularity
          ★ Each value encoded as
                  two alphanumeric characters




Thursday, March 24, 2011
Extended Encoding Function
           Similar to Simple Encoding Function
           but too big to show here.


           Grab it at
           http://code.google.com/apis/chart/docs/
           data_formats.html#encoding_data




Thursday, March 24, 2011
Extended Encoding Example
          ★ chd=t:90,1000,2700,3500|3968,-1,1100,250
          ★ chd=e:BaPoqM2s,-A__RMD6




Thursday, March 24, 2011
Data Scaling
          ★ chds=<min-value>, <max-value>
          ★ Related to the data format you use!




Thursday, March 24, 2011
Axis Scaling
          ★ chxr=<axis_index>,<start_val>,<end_val>,
                  <opt_step>


          ★ Axis labels are not calculated to reflect chart
                  data automatically! (We do that ourselves)


          ★ If you’re data is 0-100, then you’re good!

Thursday, March 24, 2011
Axis Scaling Example




Thursday, March 24, 2011
Year In The News Interactive
          ★ Load a bunch of data
                  into a DataTable

          ★ User selects which
                  data points they want
                  to see

          ★ Render a series of
                  static Google Charts

          ★ Shareable Charts
Thursday, March 24, 2011
Official Documentation
          ★ DataTable & DataView Docs
          ★ Google Visualization API
          ★ Google Charts API




Thursday, March 24, 2011
Chart Tools
          ★ Chart Wizard
                  Easy Interface for Building Charts


          ★ Live Chart Playground
                  Easy way to edit parameters


          ★ Google Code Playground
                  Online Charting Development Environment
Thursday, March 24, 2011
More Links
          ★ Easy Graphs with Google Chart Tools|Nettuts+


          ★ jQuery Google Chart Plugin


          ★ List of Google Chart Wrappers


          ★ Animating Static Google Charts

Thursday, March 24, 2011
Sharing Is Caring
          ★ Grab everything from this presentation via SVN
                  http://svn.kingkool68.com/projects/google-
                  charting-api/


          ★ List of Links Mentioned


          ★ Stay in Touch @kingkool68 or Facebook or
                  shoot me an e-mail
Thursday, March 24, 2011
And
                     Remember...

Thursday, March 24, 2011
Play and Have Fun!
                              It’s the only way to learn.




Thursday, March 24, 2011
Thank You!
                           Please say hi to me later,
                             share your thoughts,
                              and ask questions.




Thursday, March 24, 2011

Mais conteúdo relacionado

Mais procurados

ASP.Net 3.5 SP1 Dynamic Data
ASP.Net 3.5 SP1 Dynamic DataASP.Net 3.5 SP1 Dynamic Data
ASP.Net 3.5 SP1 Dynamic Datamicham
 
Visualizing your Data Natively on the HPCC Systems Platform with the “Visuali...
Visualizing your Data Natively on the HPCC Systems Platform with the “Visuali...Visualizing your Data Natively on the HPCC Systems Platform with the “Visuali...
Visualizing your Data Natively on the HPCC Systems Platform with the “Visuali...HPCC Systems
 
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)Stefan Urbanek
 
Cph Scala meetup 14.10.2021
Cph Scala meetup 14.10.2021Cph Scala meetup 14.10.2021
Cph Scala meetup 14.10.2021Yevhenii Melnyk
 
ヘルスケアサービスを実現する最新技術 〜HealthKit・GCP + Goの活用〜
ヘルスケアサービスを実現する最新技術  〜HealthKit・GCP + Goの活用〜ヘルスケアサービスを実現する最新技術  〜HealthKit・GCP + Goの活用〜
ヘルスケアサービスを実現する最新技術 〜HealthKit・GCP + Goの活用〜DeNA
 
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...Dataconomy Media
 
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADataconomy Media
 
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & Aggregation
Webinar: Applikationsentwicklung mit MongoDB: Teil 5: Reporting & AggregationWebinar: Applikationsentwicklung mit MongoDB: Teil 5: Reporting & Aggregation
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & AggregationMongoDB
 
Developing an Expression Language for Quantitative Financial Modeling
Developing an Expression Language for Quantitative Financial ModelingDeveloping an Expression Language for Quantitative Financial Modeling
Developing an Expression Language for Quantitative Financial ModelingScott Sanderson
 
D3.js 30-minute intro
D3.js   30-minute introD3.js   30-minute intro
D3.js 30-minute introFelipe
 
ヘルスケアサービスを実現する最新技術
〜HealthKit・GCP+Go〜
ヘルスケアサービスを実現する最新技術
〜HealthKit・GCP+Go〜ヘルスケアサービスを実現する最新技術
〜HealthKit・GCP+Go〜
ヘルスケアサービスを実現する最新技術
〜HealthKit・GCP+Go〜Fukaya Akifumi
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursorsinfo_zybotech
 
Visdjango presentation django_boston_oct_2014
Visdjango presentation django_boston_oct_2014Visdjango presentation django_boston_oct_2014
Visdjango presentation django_boston_oct_2014jlbaldwin
 
Sap bo 4.2 course content (1)
Sap bo 4.2 course content (1)Sap bo 4.2 course content (1)
Sap bo 4.2 course content (1)vamshireddy kunta
 

Mais procurados (18)

ASP.Net 3.5 SP1 Dynamic Data
ASP.Net 3.5 SP1 Dynamic DataASP.Net 3.5 SP1 Dynamic Data
ASP.Net 3.5 SP1 Dynamic Data
 
Visualizing your Data Natively on the HPCC Systems Platform with the “Visuali...
Visualizing your Data Natively on the HPCC Systems Platform with the “Visuali...Visualizing your Data Natively on the HPCC Systems Platform with the “Visuali...
Visualizing your Data Natively on the HPCC Systems Platform with the “Visuali...
 
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
Cubes - Lightweight Python OLAP (EuroPython 2012 talk)
 
Cph Scala meetup 14.10.2021
Cph Scala meetup 14.10.2021Cph Scala meetup 14.10.2021
Cph Scala meetup 14.10.2021
 
ヘルスケアサービスを実現する最新技術 〜HealthKit・GCP + Goの活用〜
ヘルスケアサービスを実現する最新技術  〜HealthKit・GCP + Goの活用〜ヘルスケアサービスを実現する最新技術  〜HealthKit・GCP + Goの活用〜
ヘルスケアサービスを実現する最新技術 〜HealthKit・GCP + Goの活用〜
 
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
DN 2017 | Multi-Paradigm Data Science - On the many dimensions of Knowledge D...
 
Android Sample Project By Wael Almadhoun
Android Sample Project By Wael AlmadhounAndroid Sample Project By Wael Almadhoun
Android Sample Project By Wael Almadhoun
 
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project ADN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
 
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & Aggregation
Webinar: Applikationsentwicklung mit MongoDB: Teil 5: Reporting & AggregationWebinar: Applikationsentwicklung mit MongoDB: Teil 5: Reporting & Aggregation
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & Aggregation
 
The D3 Toolbox
The D3 ToolboxThe D3 Toolbox
The D3 Toolbox
 
Developing an Expression Language for Quantitative Financial Modeling
Developing an Expression Language for Quantitative Financial ModelingDeveloping an Expression Language for Quantitative Financial Modeling
Developing an Expression Language for Quantitative Financial Modeling
 
D3.js 30-minute intro
D3.js   30-minute introD3.js   30-minute intro
D3.js 30-minute intro
 
ヘルスケアサービスを実現する最新技術
〜HealthKit・GCP+Go〜
ヘルスケアサービスを実現する最新技術
〜HealthKit・GCP+Go〜ヘルスケアサービスを実現する最新技術
〜HealthKit・GCP+Go〜
ヘルスケアサービスを実現する最新技術
〜HealthKit・GCP+Go〜
 
Viewpic
ViewpicViewpic
Viewpic
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
 
Visdjango presentation django_boston_oct_2014
Visdjango presentation django_boston_oct_2014Visdjango presentation django_boston_oct_2014
Visdjango presentation django_boston_oct_2014
 
Sap bo 4.2 course content (1)
Sap bo 4.2 course content (1)Sap bo 4.2 course content (1)
Sap bo 4.2 course content (1)
 
Booklab
BooklabBooklab
Booklab
 

Destaque

Integrating Google APIs into Your Applications
Integrating Google APIs into Your ApplicationsIntegrating Google APIs into Your Applications
Integrating Google APIs into Your ApplicationsChris Schalk
 
!(How to Kill MySQL Performance)
!(How to Kill MySQL Performance)!(How to Kill MySQL Performance)
!(How to Kill MySQL Performance)Vishnu Agarwal
 
You Don't Know Query - WordCamp Portland 2011
You Don't Know Query - WordCamp Portland 2011You Don't Know Query - WordCamp Portland 2011
You Don't Know Query - WordCamp Portland 2011andrewnacin
 
Making Symofny shine with Varnish - SymfonyCon Madrid 2014
Making Symofny shine with Varnish - SymfonyCon Madrid 2014Making Symofny shine with Varnish - SymfonyCon Madrid 2014
Making Symofny shine with Varnish - SymfonyCon Madrid 2014Barel Barelon
 
Veracity Embracing Uncertainty
Veracity Embracing UncertaintyVeracity Embracing Uncertainty
Veracity Embracing UncertaintyGalen Murdock
 
Effective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 DevelopersEffective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 DevelopersMarcin Chwedziak
 
Subversion - Utilisation et bonnes pratiques
Subversion - Utilisation et bonnes pratiquesSubversion - Utilisation et bonnes pratiques
Subversion - Utilisation et bonnes pratiquesJérôme Vieilledent
 

Destaque (8)

Integrating Google APIs into Your Applications
Integrating Google APIs into Your ApplicationsIntegrating Google APIs into Your Applications
Integrating Google APIs into Your Applications
 
!(How to Kill MySQL Performance)
!(How to Kill MySQL Performance)!(How to Kill MySQL Performance)
!(How to Kill MySQL Performance)
 
You Don't Know Query - WordCamp Portland 2011
You Don't Know Query - WordCamp Portland 2011You Don't Know Query - WordCamp Portland 2011
You Don't Know Query - WordCamp Portland 2011
 
Making Symofny shine with Varnish - SymfonyCon Madrid 2014
Making Symofny shine with Varnish - SymfonyCon Madrid 2014Making Symofny shine with Varnish - SymfonyCon Madrid 2014
Making Symofny shine with Varnish - SymfonyCon Madrid 2014
 
Google charts
Google chartsGoogle charts
Google charts
 
Veracity Embracing Uncertainty
Veracity Embracing UncertaintyVeracity Embracing Uncertainty
Veracity Embracing Uncertainty
 
Effective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 DevelopersEffective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 Developers
 
Subversion - Utilisation et bonnes pratiques
Subversion - Utilisation et bonnes pratiquesSubversion - Utilisation et bonnes pratiques
Subversion - Utilisation et bonnes pratiques
 

Semelhante a Charting with Google

M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSSupriya Radhakrishna
 
Move your data (Hans Rosling style) with googleVis + 1 line of R code
Move your data (Hans Rosling style) with googleVis + 1 line of R codeMove your data (Hans Rosling style) with googleVis + 1 line of R code
Move your data (Hans Rosling style) with googleVis + 1 line of R codeJeffrey Breen
 
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard LibraryHidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Librarydoughellmann
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursorsinfo_zybotech
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseHeiko Behrens
 
Data visualization by Kenneth Odoh
Data visualization by Kenneth OdohData visualization by Kenneth Odoh
Data visualization by Kenneth Odohpyconfi
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScriptDenis Voituron
 
01 data modeling-and-er-diagrams
01 data modeling-and-er-diagrams01 data modeling-and-er-diagrams
01 data modeling-and-er-diagramsglubox
 
See sql server graphical execution plans in action tech republic
See sql server graphical execution plans in action   tech republicSee sql server graphical execution plans in action   tech republic
See sql server graphical execution plans in action tech republicKaing Menglieng
 
Rich Internet Applications con JavaFX e NetBeans
Rich Internet Applications  con JavaFX e NetBeans Rich Internet Applications  con JavaFX e NetBeans
Rich Internet Applications con JavaFX e NetBeans Fabrizio Giudici
 
Interacting with Accumulo and Graphulo using Julia/Python D4M
Interacting with Accumulo and Graphulo using Julia/Python D4MInteracting with Accumulo and Graphulo using Julia/Python D4M
Interacting with Accumulo and Graphulo using Julia/Python D4MAccumulo Summit
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Kenji HASUNUMA
 
Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Kenji HASUNUMA
 
mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomerzefhemel
 
Charting & Data Visualization in Ext GWT 3.0
Charting & Data Visualization in Ext GWT 3.0Charting & Data Visualization in Ext GWT 3.0
Charting & Data Visualization in Ext GWT 3.0Sencha
 
Data visualization in python/Django
Data visualization in python/DjangoData visualization in python/Django
Data visualization in python/Djangokenluck2001
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue AdventureAllegient
 
JavaScript for Flex Devs
JavaScript for Flex DevsJavaScript for Flex Devs
JavaScript for Flex DevsAaronius
 

Semelhante a Charting with Google (20)

M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
 
Move your data (Hans Rosling style) with googleVis + 1 line of R code
Move your data (Hans Rosling style) with googleVis + 1 line of R codeMove your data (Hans Rosling style) with googleVis + 1 line of R code
Move your data (Hans Rosling style) with googleVis + 1 line of R code
 
Hidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard LibraryHidden Treasures of the Python Standard Library
Hidden Treasures of the Python Standard Library
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
 
Data visualization by Kenneth Odoh
Data visualization by Kenneth OdohData visualization by Kenneth Odoh
Data visualization by Kenneth Odoh
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
01 data modeling-and-er-diagrams
01 data modeling-and-er-diagrams01 data modeling-and-er-diagrams
01 data modeling-and-er-diagrams
 
See sql server graphical execution plans in action tech republic
See sql server graphical execution plans in action   tech republicSee sql server graphical execution plans in action   tech republic
See sql server graphical execution plans in action tech republic
 
Rich Internet Applications con JavaFX e NetBeans
Rich Internet Applications  con JavaFX e NetBeans Rich Internet Applications  con JavaFX e NetBeans
Rich Internet Applications con JavaFX e NetBeans
 
Interacting with Accumulo and Graphulo using Julia/Python D4M
Interacting with Accumulo and Graphulo using Julia/Python D4MInteracting with Accumulo and Graphulo using Julia/Python D4M
Interacting with Accumulo and Graphulo using Julia/Python D4M
 
Java 103
Java 103Java 103
Java 103
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2
 
Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers guide 2
 
Robotlegs Introduction
Robotlegs IntroductionRobotlegs Introduction
Robotlegs Introduction
 
mobl presentation @ IHomer
mobl presentation @ IHomermobl presentation @ IHomer
mobl presentation @ IHomer
 
Charting & Data Visualization in Ext GWT 3.0
Charting & Data Visualization in Ext GWT 3.0Charting & Data Visualization in Ext GWT 3.0
Charting & Data Visualization in Ext GWT 3.0
 
Data visualization in python/Django
Data visualization in python/DjangoData visualization in python/Django
Data visualization in python/Django
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue Adventure
 
JavaScript for Flex Devs
JavaScript for Flex DevsJavaScript for Flex Devs
JavaScript for Flex Devs
 

Mais de Russell Heimlich

Cache Rules Everything Around Me
Cache Rules Everything Around MeCache Rules Everything Around Me
Cache Rules Everything Around MeRussell Heimlich
 
Video Captioning on the Web
Video Captioning on the WebVideo Captioning on the Web
Video Captioning on the WebRussell Heimlich
 
Accessibility Lightning Talk
Accessibility Lightning TalkAccessibility Lightning Talk
Accessibility Lightning TalkRussell Heimlich
 
Building An Accessible Site from the Ground Up
Building An Accessible Site from the Ground UpBuilding An Accessible Site from the Ground Up
Building An Accessible Site from the Ground UpRussell Heimlich
 

Mais de Russell Heimlich (6)

Cache Rules Everything Around Me
Cache Rules Everything Around MeCache Rules Everything Around Me
Cache Rules Everything Around Me
 
stickyHeader.js
stickyHeader.jsstickyHeader.js
stickyHeader.js
 
Analytics And You
Analytics And YouAnalytics And You
Analytics And You
 
Video Captioning on the Web
Video Captioning on the WebVideo Captioning on the Web
Video Captioning on the Web
 
Accessibility Lightning Talk
Accessibility Lightning TalkAccessibility Lightning Talk
Accessibility Lightning Talk
 
Building An Accessible Site from the Ground Up
Building An Accessible Site from the Ground UpBuilding An Accessible Site from the Ground Up
Building An Accessible Site from the Ground Up
 

Último

UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...RitikaRoy32
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceanilsa9823
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Call Girls Basavanagudi Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Basavanagudi Just Call 👗 7737669865 👗 Top Class Call Girl Service ...Call Girls Basavanagudi Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Basavanagudi Just Call 👗 7737669865 👗 Top Class Call Girl Service ...amitlee9823
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdftbatkhuu1
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfAmirYakdi
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...amitlee9823
 
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...SUHANI PANDEY
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Delhi Call girls
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja Nehwal
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...Delhi Call girls
 
Tapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the FunnelTapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the Funneljen_giacalone
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...amitlee9823
 
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵anilsa9823
 
2-tool presenthdbdbdbdbddhdhddation.pptx
2-tool presenthdbdbdbdbddhdhddation.pptx2-tool presenthdbdbdbdbddhdhddation.pptx
2-tool presenthdbdbdbdbddhdhddation.pptxsuhanimunjal27
 
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️soniya singh
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...Call Girls in Nagpur High Profile
 

Último (20)

UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Call Girls Basavanagudi Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Basavanagudi Just Call 👗 7737669865 👗 Top Class Call Girl Service ...Call Girls Basavanagudi Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
Call Girls Basavanagudi Just Call 👗 7737669865 👗 Top Class Call Girl Service ...
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdf
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
 
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
Tapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the FunnelTapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the Funnel
 
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
Jigani Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bangal...
 
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
 
2-tool presenthdbdbdbdbddhdhddation.pptx
2-tool presenthdbdbdbdbddhdhddation.pptx2-tool presenthdbdbdbdbddhdhddation.pptx
2-tool presenthdbdbdbdbddhdhddation.pptx
 
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
Call Girls in Kalkaji Delhi 8264348440 call girls ❤️
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
 

Charting with Google

  • 1. Charting with Google Thursday, March 24, 2011
  • 2. http://bit.ly/googlechartlinks Follow along with a list of all the links mentioned Thursday, March 24, 2011
  • 3. Russell Heimlich (Like the Maneuver) ★ Sole Developer at the Pew Research Center ★ 3 Years at U.S.News & World Report ★ Creator of Dummyimage.com ★ Left handed! Thursday, March 24, 2011
  • 4. How Can Google Help Us Make Charts? ★ DataTable Object ★ Interactive Charts (Visualization API) ★ Image Charts (Chart API) Thursday, March 24, 2011
  • 5. Getting Started You have to start somewhere... http://www.flickr.com/photos/npobre/2601582256/ Thursday, March 24, 2011
  • 6. Load Some Libraries <!--Load the AJAX API--> <script src="http://www.google.com/jsapi"></script> <script type="text/javascript"> // Load the Visualization API and the piechart package. google.load('visualization', '1', {'packages':['corechart']});     // Set a callback to run when everything is loaded. google.setOnLoadCallback(drawChart); function drawChart() { // MAGIC! } </script> Thursday, March 24, 2011
  • 7. DataTable Object Like a database in JavaScript Thursday, March 24, 2011
  • 8. What is a DataTable? ★ Representation of your data in JavaScript ★ Query just like SQL ★ Sortable, Filterable, Cloneable, Manipulatable ★ Easy to pass along to different visualizations Thursday, March 24, 2011
  • 9. Making a DataTable var data = new google.visualization.DataTable(); data.addColumn('string', 'Task'); data.addColumn('number', 'Hours'); data.addRows([ ['Work', 11], ['Eat', 1], ['Commute', 2], ['Watch TV', 3] ]); Thursday, March 24, 2011
  • 10. More Ways To Populate Data // Create and populate the data table.   var data = new google.visualization.DataTable();   data.addColumn('string', 'Task');   data.addColumn('number', 'Hours per Day');    data.addRows(4);    data.setValue(0, 0, 'Work'); //row index, cell index, value   data.setValue(0, 1, 11);   data.setValue(1, 0, 'Eat');   data.setValue(1, 1, 1);   data.setValue(2, 0, 'Commute');   data.setValue(2, 1, 2);   data.setValue(3, 0, 'Watch TV');   data.setValue(3, 1, 3); Thursday, March 24, 2011
  • 11. Which Looks Like This Task Hours Work 11 Eat 1 Commute 2 Watch TV 3 Thursday, March 24, 2011
  • 12. DataViews ★ Subset of data from a DataTable ★ Remove or duplicate rows or columns ★ Original DataTable stays intact ★ Live view of the underlying data, not a copy Thursday, March 24, 2011
  • 13. Making A DataView var view = new google.visualization.DataView(data); view.setRows( view.getFilteredRows([{ column:1, maxValue:5 }]) ); Thursday, March 24, 2011
  • 14. Our DataView Now Looks Like This Task Hours Eat 1 Commute 2 Watch TV 3 Thursday, March 24, 2011
  • 15. Building Interactive Charts Getting Nitty Gritty Thursday, March 24, 2011
  • 16. Let’s Make A Pie Chart  // Create and draw the visualization. var target = document.getElementById('visualization'); new google.visualization.PieChart(target).draw( view, {title: ‘So, how was your day?’} ); Thursday, March 24, 2011
  • 17. And Play With Different Properties new google.visualization.PieChart(target).draw( view, { title: ‘So, how was your day?’, is3D: true, colors: ['#0099ff', '#00ff99', '#9900ff'] } ); Thursday, March 24, 2011
  • 18. Putting It All Together: Music Age Demo ★ Scrape data from an HTML table and put it into a DataTable ★ Dynamically create a legend for choosing what to graph ★ Make line graphs and bar charts from selected data points Thursday, March 24, 2011
  • 19. Table Scrapin’ Fun var tableHeaders = $('table th'); var tableData = $('table tbody tr'); data = new google.visualization.DataTable(); for (i=0; i<tableHeaders.length; i++) { var cell = tableHeaders[i].innerHTML; var cellType = 'number'; if (i==0) { cellType = 'string'; } data.addColumn(cellType, cell); } Thursday, March 24, 2011
  • 20. More Table Scrapin’ Fun for (i=0; i<tableData.length; i++) { var row = $(tableData[i]).children(); var rowData = new Array(); for (j=0; j<row.length; j++) { var cell = row[j].innerHTML; if (!cell.match(/[a-zA-Z_.-?!+]/)) { cell = Number(cell) } rowData.push(cell); } data.addRow(rowData); } Thursday, March 24, 2011
  • 21. Preppin’ The View var artists = $('#legend li'); var selectedArtists = [0]; $('table .on').removeClass('on'); $('table tr').children(':nth-child(1)').addClass('on'); for (i=0; i<artists.length; i++) { if (!$(artists[i]).hasClass('off')) { selectedArtists.push(i+1); $('table tr').children( ':nth-child('+ (i+2) +')' ).addClass('on'); } } var view = new google.visualization.DataView(data); view.setColumns(selectedArtists); Thursday, March 24, 2011
  • 22. Drawin’ The Line Chart $('#line').html(''); var lineChart = new google.visualization.LineChart( document.getElementById('line') ); lineChart.draw(view, { width: 500, height: 350, enableTooltip: true, showCategories: true, legend: 'none', max: 75, pointSize: 5 }); Thursday, March 24, 2011
  • 23. Drawin’ The Bar Chart $('#bar').html(''); var chart = new google.visualization.ColumnChart( document.getElementById('bar') ); chart.draw(view, { width: 500, height: 350, enableTooltip: true, showCategories: true, legend: 'none', max: 75, is3D: true }); Thursday, March 24, 2011
  • 24. Constructing Static Charts Time to put your thinking cap on Thursday, March 24, 2011
  • 25. What is the Google Chart API? “The Google Chart API lets you dynamically generate charts with a URL string. You can embed these charts on your web page, or download the image for local or offline use.” –– Google Chart Documentation Thursday, March 24, 2011
  • 26. Build a URL, Get a Chart Thursday, March 24, 2011
  • 27. What types of charts can you make? Thursday, March 24, 2011
  • 28. Every Chart Starts With A URL http://chart.googleapis.com/chart? Parameters come after the question mark separated by ampersands (&) The order of parameters doesn’t matter Thursday, March 24, 2011
  • 29. Requires 3 Things ★ Chart Type (cht=<chart type>) ★ Chart Size (chs=<width>x<height>) ★ Data (chd=<data string>) ★ http://chart.googleapis.com/chart? cht=p3&chs=250x100&chd=t:60,40 Thursday, March 24, 2011
  • 30. Data Formats ★ Basic Text Format (chd=t:) ★ Simple Encoding (chd=s:) ★ Extended Encoding (chd=e:) ★ Some formats use less characters than others. Thursday, March 24, 2011
  • 31. Basic Text Data Format ★ Floating Point Values From 0-100 ★ Values less than 0 are considered NULL ★ Values higher than 100 are truncated to 100 ★ What you see is what you get ★ Ideal for smaller datasets ★ Produces the largest number of characters Thursday, March 24, 2011
  • 32. Basic Text Data Example ★ chd=t:_30,-30,50,80,200 Thursday, March 24, 2011
  • 33. Simple Encoding Data Format ★ Integer values 0-61 ★ Relative Scaling ★ Low Granularity ★ Each value encoded as a single alphanumeric character ★ Produces the smallest number of characters Thursday, March 24, 2011
  • 34. Simple Encoding Function var simpleEncoding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' //Scales submitted values so that maxVal becomes the highest. function simpleEncode(valueArray, maxValue) { var chartData = ['s:']; for (var i = 0; i < valueArray.length; i++) { var currentValue = valueArray[i]; if (!isNaN(currentValue) && currentValue >= 0) { chartData.push(simpleEncoding.charAt( Math.round((simpleEncoding.length-1) * currentValue / maxValue)) ); } else { chartData.push('_'); } } return chartData.join(''); } Thursday, March 24, 2011
  • 35. Simple Encoding Example ★ chd=t:1,19,27,53,61,-1|12,39,57,45,51,27 ★ chd=s:BTb19_,Mn5tzb Thursday, March 24, 2011
  • 36. Extended Data Format ★ Integer values 0-4095 ★ Relative scaling ★ High Granularity ★ Each value encoded as two alphanumeric characters Thursday, March 24, 2011
  • 37. Extended Encoding Function Similar to Simple Encoding Function but too big to show here. Grab it at http://code.google.com/apis/chart/docs/ data_formats.html#encoding_data Thursday, March 24, 2011
  • 38. Extended Encoding Example ★ chd=t:90,1000,2700,3500|3968,-1,1100,250 ★ chd=e:BaPoqM2s,-A__RMD6 Thursday, March 24, 2011
  • 39. Data Scaling ★ chds=<min-value>, <max-value> ★ Related to the data format you use! Thursday, March 24, 2011
  • 40. Axis Scaling ★ chxr=<axis_index>,<start_val>,<end_val>, <opt_step> ★ Axis labels are not calculated to reflect chart data automatically! (We do that ourselves) ★ If you’re data is 0-100, then you’re good! Thursday, March 24, 2011
  • 42. Year In The News Interactive ★ Load a bunch of data into a DataTable ★ User selects which data points they want to see ★ Render a series of static Google Charts ★ Shareable Charts Thursday, March 24, 2011
  • 43. Official Documentation ★ DataTable & DataView Docs ★ Google Visualization API ★ Google Charts API Thursday, March 24, 2011
  • 44. Chart Tools ★ Chart Wizard Easy Interface for Building Charts ★ Live Chart Playground Easy way to edit parameters ★ Google Code Playground Online Charting Development Environment Thursday, March 24, 2011
  • 45. More Links ★ Easy Graphs with Google Chart Tools|Nettuts+ ★ jQuery Google Chart Plugin ★ List of Google Chart Wrappers ★ Animating Static Google Charts Thursday, March 24, 2011
  • 46. Sharing Is Caring ★ Grab everything from this presentation via SVN http://svn.kingkool68.com/projects/google- charting-api/ ★ List of Links Mentioned ★ Stay in Touch @kingkool68 or Facebook or shoot me an e-mail Thursday, March 24, 2011
  • 47. And Remember... Thursday, March 24, 2011
  • 48. Play and Have Fun! It’s the only way to learn. Thursday, March 24, 2011
  • 49. Thank You! Please say hi to me later, share your thoughts, and ask questions. Thursday, March 24, 2011