Quick & Easy Data Visualization with Google Visualization API + Google Chart Libraries Bohyun Kim ( Twitter: Associate Director for.

Slides:



Advertisements
Similar presentations
Measurement Myths in Health Social Media
Advertisements

HTML Basic Lecture What is HTML? HTML (Hyper Text Markup Language) is a a standard markup language used for creating and publishing documents on.
OCLC Grid Services Boot Camp About the WorldCat API Bruce Washburn Consulting Software Engineer, OCLC.
Like-Write Team 1 Flat Classroom- ASB Unplugged. Like-write Writing allows you to share your ideas efficiently and is the backbone of asynchronous communication.
Electronic Library and Information Resources Introduction and overview.
Alabama Virtual Library
Media Center Essential Question How can I be an effective user of information?
Dealing with the chaos monkey
AddressingHistory – Tracing the Past Stuart Macdonald AddressingHistory Project Manager Nicola Osborne Project Officer & EDINA Social Media Officer EDINA.
A centre of expertise in digital information management UKOLN is supported by: Acting as Advocate? Seven steps for libraries in the data.
Social web case study: solving problems for your institution Jo Alcock Evidence Base Birmingham City University.
Visual Learning, Online Social Networks and Knowledge Construction Dr. Marina McIsaac Arizona State University Dr.
Williams Family Photo Album. Photo Album Project.
Paper-based Reference Books Newspapers Periodicals Directories Maps etc Information that is stored by traditional means.
Bruce Scharlau, University of Aberdeen, 2008 RESTful Assessments.
WELCOME! University Library Services. 3 Libraries & Online Business Computing Education (Primary) Engineering Law Media Psychology Tourism English Languages.
Media Center Essential Question How can I be an effective user of information?
The problem with Google images Or, how to use great tools wisely… and avoid plagiarism at the same time.
CHANDRA X-RAY OBSERVATORY The Universe in a Whole New Light Joe DePasquale & Kim Arcand AVM and Chandra: An Update on Lessons Learned.
Alerts: Following your publications wherever they go How to create alerts using the following tools: – Google scholar
Alabama Virtual Library A World of Knowledge at Your Fingertips.
Finding Academic Literature in Physics Richard Holmes, Durham University Library.
Assessing our Assessment: Failures and Successes at UT-Austin AJ Johnson, Michele Ostrow, Meghan Sitar Library Instruction Services University of Texas.
Web Services Mash-up : Flickr Cal Henderson O’Reilly Emerging Technology Conference March 14-17, 2005.
+ Dr. Alice Christie President’s Professor Emeritus Engaging Students and Increasing Student Learning by Using Technology in K-12 Classrooms Arizona State.
P-184 Sage Intelligence: Financial Reporting for Sage ERP X3 Stephen Coull – Sales Director, Sage Alchemex.
Print meets Web 2.0. Information sharing Interoperability User-centered design Collaboration Web 2.0.
Excelets: A Learning Tool to Captivate the Google Generation Scott A. Sinex Department of Physical Sciences and Engineering Prince George’s Community College.
W alkie Doggie is a web application that allows dog owners to help each other with their dog walks. It’s main feature is the walkies, which are the user’s.
Data journalism: The myths and the magic ASNE Convention Washington, DC June 25, 2013.
A New Method for Locating and Accessing Library Map Collections Google Map “Mashups” Kristi Jensen, Map Librarian University of Minnesota – Twin Cities.
L. Grewe. YQL – what is it Yahoo! Query Language.
Internet Collaboration Tools: Yahoo! Groups Spencer S. Eccles Health Sciences Library University of Utah Health Sciences Center.
Introduction to Python John Alexis Guerra Gómez CMSC433 Spring 2010 University of Maryland.
InfoPath Forms and Workflows in SP 2010 Wylde Solutions Sydney SharePoint User Group 18 September 2011 Sydney, Australia.
Keeping up with the literature The efficient way.
King Abdullah University of Science and Technology (KAUST) Library World Digital Library Meeting Qatar Foundation December 13, 2010.
Integrating Technology into Social Studies Curriculum Integrating Technology into Social Studies Curriculum.
Jing Presented by Allison McKiernan MLIS Candidate Louisiana Library Association Preconference 2010 McKiernan.
NLM-Semantic Medline Data Science Data Publication Commons Dr. Brand Niemann Director and Senior Data Scientist/Data Journalist Semantic Community Data.
2012 National BDPA Technology Conference Creating Rich Data Visualizations using the Google API Yolanda M. Davis Senior Software Engineer AdvancED August.
Information Seeking Behaviors of Local Public Health Practitioners: A Case Study from a Kentucky Health Department Robert M Shapiro, MALS; Alex F Howard,
Created by: Brittany Stephens. The Good 1.Hand-eye coordination 2.Quick thinking/quick decision making.
Open Education Resources Carol Myers Director College Technology December 11, 2009.
Welcome to the Katrina Pescador Director of Library & Archives.
Creating With Code.
Data, Docs, Maps and … Text: The functional side(s) of new media Andrew Chavez Associate Director / Digital Initiatives Texas Center for Community Journalism.
Using the Internet at City Hall FAST Internet Connections! Employee computers connected to T3 line Employee computers connected to T3 line Most Web pages.
Dr. Martin Zhao Sept 4, Topics HTML and related tutorials on w3schools.com Related HTML tags Adding interesting features using JavaScript What is.
WISER Economics Mark Janes Social Sciences Subject Consultant
NMC 2.0 The Content is You Alan Levine, NMC Tom Hapgood, University of Arkansas Creative Commons licensed flickr photo by wondrous22flickr photo by wondrous22.
Google Apps for Department of Education. 2-Day Training Agenda What is Google Apps? Why Google Apps Example Uses o Gmail o Google Calendar o Google Documents.
Images & Video. Why Use Images & Video “A picture says a thousand words” Visually engaging Can be easy to understand Complements the written content.
Photo Album by Completed by: Kala Bremner.
Fireballs... Reporting made easier. The challenge (1) Most people who see a fireball : Were not expecting it to appear Have no knowledge of the night.
Video Room Set Up 4 Major Types of Video Conferencing Solutions.
Bilal Orhan Enrique G. Ortiz.  Friend mapping for the masses  Easy to use Facebook App to view friends’ current location on a map.
亚洲的位置和范围 吉林省白城市洮北区教师进修学校 郑春艳. Q 宠宝贝神奇之旅 —— 亚洲 Q 宠快递 你在网上拍的一套物理实验器材到了。 Q 宠宝贝打电话给你: 你好,我是快递员,有你的邮件,你的收货地址上面 写的是学校地址,现在学校放假了,能把你家的具体 位置告诉我吗? 请向快递员描述自己家的详细位置!
InfoPath Forms and Workflows in SP 2010 Wylde Solutions Sydney SharePoint User Group 18 September 2011 Sydney, Australia.
Jeanne Gleason, EdD, Director/Professor, Media Production New Mexico State University Learning Games Lab Roger Terry,
Introduction to library research Pol 150: science, policy & innovation
IT Budgeting with Scarcity
Programming by a Sample: Rapidly Creating Web Applications with d.mix
Research and References
Refocus. Refocus Rapid response Right messages.
Data Visualizer for CommCare
Ideation to Prototype: Turning new ideas into useful services
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

Quick & Easy Data Visualization with Google Visualization API + Google Chart Libraries Bohyun Kim ( Twitter: Associate Director for Library Applications & Knowledge Systems University of Maryland, Baltimore Health Sciences & Human Services Library CODE4LIB Conference, Raleigh, NC. Mar. 25, 2014.

0. Spreadsheets Ain’t Databases. CIRC Newspaper holdings Textbook lists ACQ Newspaper holdings Textbook lists REF Newspaper holdings Textbook lists WEB Newspaper holdings Textbook lists

Creating a web application with a database is not always a solution available, convenient, or efficient. Image from Flickr CreativeCommons

1. But What If They Were … Almost? Data Source <-- Google Spreadsheet Query data <-- Google Visualization API Query Language Display on the web <-- Google Chart Libraries

2. Google Visualization API Query Language Allows you to perform various data manipulations with the query to the data source, such as Google spreadsheet, fusion table, or your own database. Enables you to query the data source and visualize data with Google Chart Libraries Similar to SQL language language Google Visualization API Reference: nce nce

Google Spreadsheet – widely used

URLs for a G Spreadsheet In Google Spreadsheet – Sheet3 0c2ZmaVpOQWkyY0l1eVE&usp=drive_web#gid=2 HTML Table Dc3aC1xS2o0c2ZmaVpOQWkyY0l1eVE&gid=2 Raw Data Response : includes a DataTable that you can retrieve by calling getDataTable() c2ZmaVpOQWkyY0l1eVE&gid=2 c2ZmaVpOQWkyY0l1eVE&gid=2 google.visualization.DataTable Class e e Query Language Reference (Version 0.7) ng_the_Query_in_the_Data_Source_URLhttps://developers.google.com/chart/interactive/docs/querylanguage#Setti ng_the_Query_in_the_Data_Source_URL

Raw Data response from G spreadsheet

Datatable from G spreadsheet

3-1. Query the Spreadsheet & Display the Result as a Web page Step 1. Form a query : Show column B, C, D, F where C contains ‘Florida’ Step 2. Output the query result As a stand-alone web page with a table (Needed: URL) OR Into your web page as a table / chart (Needed: JavaScript, G Chart Libraries)

Example G Spreadsheet XSVVraGxacEE&usp=drive_web#gid=0

What Goes into the URL tq? tqx=out:html &tq=select B,C,D,F where (C contains 'Florida’) &key=0AqAPbBT_k2VUdEtXYXdLdjM0TXY1YUV hMk9jeUQ0NkE &gid=0 (optional for Sheet1)

ntains+%27Florida%27%29&key=0AqAPbBT_k2VUdEtXYXdLdjM0TXY1YUVhMk9jeUQ0N kE Result of the query: SELECT B, C, D, F WHERE C CONTAINS ‘Florida’ N.B. Google Spreadsheet Size Limit: 400k cells, 256 columns, 20 MB

e+%28B+contains+%27Agoulnik%27%29&key=0AqAPbBT_k2VUdEtXYXdLdj M0TXY1YUVhMk9jeUQ0NkE

SELECT D,F COUNT(C) WHERE (B CONTAINS ‘Agoulnik’) GROUP BY D, F contains+%27Agoulnik%27%29+group+by+D,F&key=0AqAPbBT_k2VUdEtXYXdLdjM0TXY1Y UVhMk9jeUQ0NkE

Query Options Order by, Limit, Offset, Group By (), Pivot Label, Format avg(), max(), min() count(), sum() year(), month(), date(), hour() minute(), second(), millisecond() quarter(), dayOfWeek(), now(), dateDiff() toDate(), upper(), lower() docs/querylanguage#Options docs/querylanguage#Options

PIVOT

select sum(B) pivot C t%28C%29&key=0AqAPbBT_k2VUdHg4X08zMXFMeXRmdURJNUx5blpYUmc

select c, sum(B) group by (C) oup%20by%28C%29&key=0AqAPbBT_k2VUdHg4X08zMXFMeXRmdURJNUx5blpYUmc&g id=0

select A, sum(B) group by A pivot C 0group%20by%20A%20pivot%20C&key=0AqAPbBT_k2VUdHg4X08zMXFMeXRmdURJNUx 5blpYUmc&gid=0

select C, sum(B) group by C pivot A 20group%20by%20C%20pivot%20A&key=0AqAPbBT_k2VUdHg4X08zMXFMeXRmdURJN Ux5blpYUmc&gid=0

3-2. Use JS instead of a URL More flexible and you can add control options for users. To set the query string from within JavaScript code, call the setQuery method of the google.visualization.Query class. google.visualization.Query

Drop It into Your Own Web Page Query: SELECT B, C, D, F WHERE C contains ‘Florida’

Parameters headers=N - Specifies how many rows are header rows, where N is an integer zero or greater. These will be excluded from the data and assigned as column labels in the data table. If not specified, the spreadsheet will guess how many rows are header rows. Range=NN:NN Example: range=A1:C6 gid=N - Specifies which sheet in a multi-sheet document to link to, if you are not linking to the first sheet. N is the sheet's ID number. Example: gid=0 (for Sheet1) sheet=sheet_name - Specifies which sheet in a multi-sheet document you are linking to, if you are not linking to the first sheet. sheet_name is the display name of the sheet. You can use the gid parameter instead of this parameter. Example: sheet=Sheet5

4. Visualize Your G Spreadsheet Data Using Google Chart Libraries The most common way to use Google Charts is with simple JavaScript that you embed in your web page. 1.You load some Google Chart libraries. 2.List the data to be charted. 3.Select options to customize your chart. 4.Create a chart object with an id that you choose. 5.Then, later in the web page, you create a with that id to display the Google Chart.

Visualize as a table or a chart To set the query string from within JavaScript code, call the setQuery method of the google.visualization.Query class.google.visualization.Query 3 chart drawing techniques: chart.draw() ChartWrapper DrawChart() See also: wing_charts wing_charts

(a) chart.draw() Process Load the JSAPI, Google Visualization, and chart libraries. Prepare your data. Prepare any chart options. Instantiate the chart class, passing in a handle to the page container element. Optionally register to receive any chart events. If you intend to call methods on the chart, you should listen for the "ready" event. Call chart.draw(), passing in the data and options. Advantages You have complete control over every step of the process. You can register to listen for all events thrown by the chart. Disadvantages Verbose You must explicitly load all required chart libraries If you send queries, you must manually implement for the callback, check for success, extract the returned DataTable, and pass it to the chart.

example1._florida.html

Separate the Query from URL

Multiple charts

example2_chartdraw.html Adapted from: Traci L. Ruthkoski, Google Visualization API Essentials, Packt, 2013.

(b) chartwrapper ChartWrapperChartWrapper is a convenience class that handles loading all the appropriate chart libraries for you and also simplifies sending queries to Chart Tools Datasources. Advantages: Much less code Loads all the required chart libraries for you Makes querying data sources much easier by creating the Query object and handling the callback for you Pass in the container element ID, and it will call getElementByID for you. Data can be submitted in a variety of formats: as an array of values, as a JSON literal string, or as a DataTable handle Disadvantages: ChartWrapper currently propagates only the select, ready, and error events. To get other events, you must get a handle to the wrapped chart and subscribe to events there. See the ChartWrapper documentation for examples.ChartWrapper documentation

Line chart - query: 'SELECT A,D WHERE D > 100 ORDER BY D', wrapper

(c) Drawchart() DrawChart() is a global static method that wraps a ChartWrapper. Advantages: Same as ChartWrapper, but slightly shorter to use. Disadvantages: Does not return a handle to the wrapper, so you cannot handle any events.

example3_piechart.html

5. Use Data from Your Own Database with Google Chart Libraries

Simple G DataTable

G Spreadsheet

Datatable response le.com/tq?&tq=&key=0Aq APbBT_k2VUdFgwUm5oe HNEajlhODJoR2pVVWlTeF E&gid=0

JSON Feed from G Spreadsheet oR2pVVWlTeFE/1/public/values?alt=json-in-script&callback=cb

An Example MySQL db table Source for the PHP script on the next slide: complete-example

Construct G DataTable from MySQL db { "cols":[{"label":"Weekly Task","type":"string"},{"label":"Percentage","type":" number"}], "rows":[{"c":[{"v":"Sleep"},{"v":30}]},{"c":[{"v":"Watc hing Movie"},{"v":10}]},{"c":[{"v":"Job"},{"v":40}]},{"c":[{" v":"Exercise"},{"v":20}]}] }

complete-example

6. Controls and Dashboards

Draw a Dashboard 1. Create An HTML Skeleton For Your Dashboard 2. Load Your Libraries 3. Prepare Your Data 4. Create a Dashboard Instance 5. Create Control and Chart Instances 6. Establish Dependencies (=bind) 7. Draw Your Dashboard 8. Programmatic Changes after Draw google.load('visualization', '1.0',{'packages':['controls']}); …. dashboard.bind(donutRangeSlider, pieChart); dashboard.draw(data);

example4_controls.html

Dashboard with multiple controls and a remote data source new google.visualization.Dashboard(document.getElementById('dashboard')).bind([slider, categoryPicker], [pie, table]).draw(data);

example5_dashboard.html

Google Code playground

Google Public Data Explorer

Questions? Slides: Code: Twitter: Web: Image credit for the title slide: by the Flickr