Creating graphics with Google Docs
Last week I taught a session on visualizing data at the Knight Center, highlighting free and easy-to-use multimedia tools. Over the next couple of days, I’ll be posting tutorials on everything we discussed. Last week I posted tutorials on basics of HTML and Tableizer, which converts a spreadsheet into HTML.
Today, we’re going to create interactive graphics using the same unemployment rate information we used with Tableizer.
If you haven’t already done so, create a Google Docs account. You do not have to have a GMail account to use Google Docs — you can use your work e-mail address or a Hotmail account or a Yahoo account or any other.
With Google Docs, you can create documents, spreadsheets and presentations, and upload files that have been saved in Microsoft Word or Excel, or Open Office. Google Docs also offers a few functions that those other programs do not, and lets you share with others so more than one person can add to or edit a file.
After logging in, create a new spreadsheet. Copy this table (start with “year”, highlight the rest of the table and copy the data — ctrl-C on a PC or command-C on Apple) and paste it into your new spreadsheet.
| Year | January | February | March | April | May | June | July | August | September | October | November | December |
| 1999 | 4.3 | 4.4 | 4.2 | 4.3 | 4.2 | 4.3 | 4.3 | 4.2 | 4.2 | 4.1 | 4.1 | 4 |
| 2000 | 4 | 4.1 | 4 | 3.8 | 4 | 4 | 4 | 4.1 | 3.9 | 3.9 | 3.9 | 3.9 |
| 2001 | 4.2 | 4.2 | 4.3 | 4.4 | 4.3 | 4.5 | 4.6 | 4.9 | 5 | 5.3 | 5.5 | 5.7 |
| 2002 | 5.7 | 5.7 | 5.7 | 5.9 | 5.8 | 5.8 | 5.8 | 5.7 | 5.7 | 5.7 | 5.9 | 6 |
| 2003 | 5.8 | 5.9 | 5.9 | 6 | 6.1 | 6.3 | 6.2 | 6.1 | 6.1 | 6 | 5.8 | 5.7 |
| 2004 | 5.7 | 5.6 | 5.8 | 5.6 | 5.6 | 5.6 | 5.5 | 5.4 | 5.4 | 5.5 | 5.4 | 5.4 |
| 2005 | 5.2 | 5.4 | 5.2 | 5.2 | 5.1 | 5.1 | 5 | 4.9 | 5 | 5 | 5 | 4.8 |
| 2006 | 4.7 | 4.8 | 4.7 | 4.7 | 4.7 | 4.6 | 4.7 | 4.7 | 4.5 | 4.4 | 4.5 | 4.4 |
| 2007 | 4.6 | 4.5 | 4.4 | 4.5 | 4.5 | 4.6 | 4.7 | 4.7 | 4.7 | 4.8 | 4.7 | 4.9 |
| 2008 | 4.9 | 4.8 | 5.1 | 5 | 5.5 | 5.6 | 5.8 | 6.2 | 6.2 | 6.6 | 6.8 | 7.2 |
| 2009 | 7.6 | 8.1 | 8.5 |
Save and name the spreadsheet: Click the “save” button above the blue toolbar on the right.
First, let’s create a chart. Fair warning: These are not the most beautiful charts you’ve ever seen.
(See what I mean?)
- Here’s how to create it:
- In the toolbar, click on Insert > Chart. A new window will open with several different types of charts.
- With this information, a line chart works best. Click on “lines” and select the subtype you like best.
- To include all of the data, change “What data?” to A1:M12. A1 represents the first cell (column A, row 1) and M12 represents the last cell (column M, row 12). The colon establishes that you want the range from A1 to M12.
- In this spreadsheet, row 1 describes the information in each column; mark the “Use row 1 as labels” box. Column A describes the information in each row; mark the “Use column A as labels” box.
- You can add a chart title and description for the axes: The horizontal axis would be the months, and the vertical axis would be the rate.
- Save the chart — there’s a button under the preview.
- The chart will be saved on top of your spreadsheet. I like to move them to a new page so I can continue to edit the spreadsheet if needed. Click on the chart, and it will be outlined by a gray box with the word “Chart” and an arrow in the top left corner. Click on that arrow; the last option is “Move to own sheet.” After it is moved, there will be a series of gray buttons above the chart. Use those buttons to edit the chart, publish it or to save the image.
- To publish the chart in a blog or story, click on the “publish chart” button. A new window will open with an embed code — in this case, it is nothing more than an HTML image tag. The charts are rather large and bulky — if you would rather use a smaller version, save the image (the button next to the “publish chart” button) and resize it. You can then upload the image to your site and write the HTML to add it to your blog or story.
Gadgets
That works for a flat, non-interactive chart. But Google Spreadsheets can do better with gadgets. The great thing about gadgets: They’re interactive. The not-so-great thing: They’re picky, and usually require spreadsheets to be formatted in a specific way. We’re going to create two gadgets: The first will be an interactive version of the chart above; the second will be much more fun and will show how that unemployment rate has changed over time.
To make the first gadget, the table needs to be rearranged a bit — basically, each row needs to be a column. Lucky for you, I was bored on a Sunday night: Copy this table and paste it into a new sheet in your spreadsheet. (To add a sheet, click on the “add sheet” button under the spreadsheet.)
| 1999 | 2000 | 2001 | 2002 | 2003 | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 |
| 4.3 | 4 | 4.2 | 5.7 | 5.8 | 5.7 | 5.2 | 4.7 | 4.6 | 4.9 | 7.6 |
| 4.4 | 4.1 | 4.2 | 5.7 | 5.9 | 5.6 | 5.4 | 4.8 | 4.5 | 4.8 | 8.1 |
| 4.2 | 4 | 4.3 | 5.7 | 5.9 | 5.8 | 5.2 | 4.7 | 4.4 | 5.1 | 8.5 |
| 4.3 | 3.8 | 4.4 | 5.9 | 6 | 5.6 | 5.2 | 4.7 | 4.5 | 5 | |
| 4.2 | 4 | 4.3 | 5.8 | 6.1 | 5.6 | 5.1 | 4.7 | 4.5 | 5.5 | |
| 4.3 | 4 | 4.5 | 5.8 | 6.3 | 5.6 | 5.1 | 4.6 | 4.6 | 5.6 | |
| 4.3 | 4 | 4.6 | 5.8 | 6.2 | 5.5 | 5 | 4.7 | 4.7 | 5.8 | |
| 4.2 | 4.1 | 4.9 | 5.7 | 6.1 | 5.4 | 4.9 | 4.7 | 4.7 | 6.2 | |
| 4.2 | 3.9 | 5 | 5.7 | 6.1 | 5.4 | 5 | 4.5 | 4.7 | 6.2 | |
| 4.1 | 3.9 | 5.3 | 5.7 | 6 | 5.5 | 5 | 4.4 | 4.8 | 6.6 | |
| 4.1 | 3.9 | 5.5 | 5.9 | 5.8 | 5.4 | 5 | 4.5 | 4.7 | 6.8 | |
| 4 | 3.9 | 5.7 | 6 | 5.7 | 5.4 | 4.8 | 4.4 | 4.9 | 7.2 |
Let’s build the first gadget:
- In the toolbar, click on Insert > Gadget. A new window will open, allowing you to pick the kind of gadget you want to create. For this one, click on the “charts” link on the left; on the left, under the line chart, click the “Add to spreadsheet” button.
- In the new window, change the range to A1:K13. Change the number of header rows to 1. Click “apply.” The gadget should look very similar to the chart, but when you click on the points, the year and unemployment rate will show up in an information bubble. Add a title and axes labels as you want, then click “apply and close.”
- To add the gadget to your blog or website, click on the arrow on the right side of the gray bar above the gadget. Click on the publish link. Copy the embed code and paste it in your site. If the gadget is too big, you can change it: The last numbers of the embed code are the height and width. It just takes a little bit of math to keep the gadget proportional.
That’s a nice graphic, but not as useful as it could be. So let’s rearrange the information again, and create a new gadget. This time, I assigned a date to go with each number. The gadget requires a specific date, so instead of “January 2005,” I used “Jan. 1, 2005.” (Google changes the format to 1/1/05.) It’s a funny-looking table, I know.
| Date | Unemployment rate |
| 1/1/1999 | 4.3 |
| 2/1/1999 | 4.4 |
| 3/1/1999 | 4.2 |
| 4/1/1999 | 4.3 |
| 5/1/1999 | 4.2 |
| 6/1/1999 | 4.3 |
| 7/1/1999 | 4.3 |
| 8/1/1999 | 4.2 |
| 9/1/1999 | 4.2 |
| 10/1/1999 | 4.1 |
| 11/1/1999 | 4.1 |
| 12/1/1999 | 4 |
| 12/1/2000 | 4 |
| 2/1/2000 | 4.1 |
| 3/1/2000 | 4 |
| 4/1/2000 | 3.8 |
| 5/1/2000 | 4 |
| 6/1/2000 | 4 |
| 7/1/2000 | 4 |
| 8/1/2000 | 4.1 |
| 9/1/2000 | 3.9 |
| 10/1/2000 | 3.9 |
| 11/1/2000 | 3.9 |
| 12/1/2000 | 3.9 |
| 1/1/2001 | 4.2 |
| 2/1/2001 | 4.2 |
| 3/1/2001 | 4.3 |
| 4/1/2001 | 4.4 |
| 5/1/2001 | 4.3 |
| 6/1/2001 | 4.5 |
| 7/1/2001 | 4.6 |
| 8/1/2001 | 4.9 |
| 9/1/2001 | 5 |
| 10/1/2001 | 5.3 |
| 11/1/2001 | 5.5 |
| 12/1/2001 | 5.7 |
| 1/1/2002 | 5.7 |
| 2/1/2002 | 5.7 |
| 3/1/2002 | 5.7 |
| 4/1/2002 | 5.9 |
| 5/1/2002 | 5.8 |
| 6/1/2002 | 5.8 |
| 7/1/2002 | 5.8 |
| 8/1/2002 | 5.7 |
| 9/1/2002 | 5.7 |
| 10/1/2002 | 5.7 |
| 11/1/2002 | 5.9 |
| 12/1/2002 | 6 |
| 1/1/2003 | 5.8 |
| 2/1/2003 | 5.9 |
| 3/1/2003 | 5.9 |
| 4/1/2003 | 6 |
| 5/1/2003 | 6.1 |
| 6/1/2003 | 6.3 |
| 7/1/2003 | 6.2 |
| 8/1/2003 | 6.1 |
| 9/1/2003 | 6.1 |
| 10/1/2003 | 6 |
| 11/1/2003 | 5.8 |
| 12/1/2003 | 5.7 |
| 1/1/2004 | 5.7 |
| 2/1/2004 | 5.6 |
| 3/1/2004 | 5.8 |
| 4/1/2004 | 5.6 |
| 5/1/2004 | 5.6 |
| 6/1/2004 | 5.6 |
| 7/1/2004 | 5.5 |
| 8/1/2004 | 5.4 |
| 9/1/2004 | 5.4 |
| 10/1/2004 | 5.5 |
| 11/1/2004 | 5.4 |
| 12/1/2004 | 5.4 |
| 1/1/2005 | 5.2 |
| 2/1/2005 | 5.4 |
| 3/1/2005 | 5.2 |
| 4/1/2005 | 5.2 |
| 5/1/2005 | 5.1 |
| 6/1/2005 | 5.1 |
| 7/1/2005 | 5 |
| 8/1/2005 | 4.9 |
| 9/1/2005 | 5 |
| 10/1/2005 | 5 |
| 11/1/2005 | 5 |
| 12/1/2005 | 4.8 |
| 1/1/2006 | 4.7 |
| 2/1/2006 | 4.8 |
| 3/1/2006 | 4.7 |
| 4/1/2006 | 4.7 |
| 5/1/2006 | 4.7 |
| 6/1/2005 | 4.6 |
| 7/1/2006 | 4.7 |
| 8/1/2006 | 4.7 |
| 9/1/2006 | 4.5 |
| 10/1/2006 | 4.4 |
| 11/1/2006 | 4.5 |
| 12/1/2006 | 4.4 |
| 1/1/2007 | 4.6 |
| 2/1/2007 | 4.5 |
| 3/1/2007 | 4.4 |
| 4/1/2007 | 4.5 |
| 5/1/2007 | 4.5 |
| 6/1/2007 | 4.6 |
| 7/1/2007 | 4.7 |
| 8/1/2007 | 4.7 |
| 9/1/2007 | 4.7 |
| 10/1/2007 | 4.8 |
| 11/1/2007 | 4.7 |
| 12/1/2007 | 4.9 |
| 1/1/2008 | 4.9 |
| 2/1/2008 | 4.8 |
| 3/1/2008 | 5.1 |
| 4/1/2008 | 5 |
| 5/1/2008 | 5.5 |
| 6/1/2008 | 5.6 |
| 7/1/2008 | 5.8 |
| 8/1/2008 | 6.2 |
| 9/1/2008 | 6.2 |
| 10/1/2008 | 6.6 |
| 11/1/2008 | 6.8 |
| 12/1/2008 | 7.2 |
| 1/1/2009 | 7.6 |
| 2/1/2009 | 8.1 |
| 3/1/2009 | 8.5 |
Creating this gadget is very similar to the previous gadget. In the toolbar, click on Insert > Gadget. Click on the “charts” link on the left; on the left, add the “Interactive Time Series Chart.” Change the range to A1:B124. You should get an interactive gadget like this:
Tomorrow: Building interactive graphics with Many Eyes.
- Posted by Erica Smith at 08:17 pm / Permalink for this post
- Filed under: , Google Docs, interactive graphics, tutorial
- RSS comments feed for this post

No comments