24
Once Upon A Datum: Graphing Crime Incidents with Google Charts – “The Rapid Fire Version” Michelle Minkoff, Interactive Producer, The Associated Press

Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Embed Size (px)

DESCRIPTION

Tutorial and links here: http://michelleminkoff.com/crime-stats/onachartingworkshoplinks.html Tips and screenshots that walk through interactive charting using the Google Chart API. Simpler programming geared toward journalists who have minimal/intermediate experience with HTML/CSS, or thereabouts. Presented at the Online News Association's September 2011 conference in Boston.

Citation preview

Page 1: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Once Upon A Datum: Graphing Crime Incidents with Google Charts – “The

Rapid Fire Version”

Michelle Minkoff,Interactive Producer,The Associated Press

Page 2: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Where to get resourcesBit.ly/onagraphingcrimestats

Working sampleThese slidesFormatted data, so you can play alongTutorial walkthroughCheat sheat with other charting tips/tricks to know

Find me to exchange ideas/ask questions/point out errors, etc. Best way is @michelleminkoff on Twitter or [email protected].

Page 3: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Crime stats released this week

Often, developing charts is done too fast to be done well, or done well, but not at deadline speed

Prepare for a story

Data released, what to do? Graphs help you report, and tell a story.

Go to FBI crime stats page: http://www.fbi.gov/about-us/cjis/ucr/crime-in-the-u.s/2010/crime-in-the-u.s.-2010

Page 4: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston
Page 5: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

How did categories of crime change (if at all)?

Page 6: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

What we’re after: michelleminkoff.com/crime-stats

Page 7: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Ah, deadline! What graphing library to use?

What is a graphing library? Tradeoff of flexibility/difficulty

Protovis

Raphael

Flot

Google Image Charts

Google Chart Tools (prev. Google Visualization API)

Page 8: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Get the dataDownload an Excel file

Page 9: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Format the data in Excel

Page 10: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Excel > JSON

Use Mr. Data Converter - http://shancarter.com/data_converter/

Paste data in top box

Page 11: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Excel > JSONSelect JSON > Row Arrays

Copy text that is returned to you

Page 12: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

JSON > JSON fileSave that formatted data!

Page 13: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Basic HTML

Page 14: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Souped-up HTML

Page 15: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Quick CSS

Page 16: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Draw the graph

Page 17: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Draw the graph (2/2)

Page 18: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

How do I choose my colors?

Page 19: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Format numbers

Page 20: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Insert it in HTMLAs easy as bringing that code in and calling the

drawVisualization() function from <script> tags in your CMS, and including the div name

But I’m not satisfied!

I want to switch states – enter the change fuction

Page 21: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Changing states

Page 22: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Put it all together

Page 23: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

How do I get it in my CMS/on my website?

CMS: Just need to load API

The inline script tag, loading the chart you’re using

Code that’s in our drawVisualization() function

A div with the same id that’s referred to in drawVisualization()

Whole page: Upload a four-file structure in same folder, like what we created today

Page 24: Charting Crime Categories - Easy(ier) Programming w/Google Chart Tools - ONA 2011 Boston

Voila!And there you have it!

Thanks!