• Microsoft
  • Nebula
  • Google
  • SugarCRM
  • Facebook
  • HP
  • Intel
  • Rackspace Hosting
  • WSO2
  • Alfresco
  • BlackBerry
  • Dell
  • eBay
  • Heroku
  • InfiniteGraph
  • JBoss
  • LeaseWeb
  • Liferay
  • Media Temple, Inc.
  • OpenShift
  • Oracle
  • Percona
  • Puppet Labs
  • Qualcomm Innovation Center, Inc.
  • Rentrak
  • Silicon Mechanics
  • SoftLayer Technologies, Inc.
  • SourceGear
  • Urban Airship
  • Vertica
  • VMware
  • (mt) Media Temple, Inc.

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at the convention, contact Sharon Cordesse at scordesse@oreilly.com

Download the OSCON Sponsor/Exhibitor Prospectus

Contact Us

View a complete list of OSCON contacts

Visualizing Economic Data Using Perl and HTML5's Canvas

A.Sinan Unur (Unur)
Location: Portland 256
Average rating: *....
(1.60, 5 ratings)

Government sites such as bea.gov and census.gov provide lot of interesting data relevant current events. These data are usually provided in dense spreadsheet tables with limited, if any, charting facilities making them relatively inaccessible to the casual visitor. As a former Economics and Statistics educator, I have an interest in presenting data in a straightforward, visual manner.

Perl’s libraries such as Text::CSV, HTML::TableExtract, Spreadsheet::ParseExcel provide means to extract relevant information from data distributed in commonly used file formats.

With the advent of HTML5’s canvas element, the task of generating graphics can be offloaded to the visitor’s web browser (ignoring, for the moment issues with browser support for this feature). Web applications can avoid external graphics files, instead embedding the data necessary to produce a chart in a table element in the HTML. Such a table can then be displayed as a chart using unobtrusive JavaScript, if the client browser supports it.

Recently, Perl has gained a number of simple Web application frameworks. One of these is Dancer . Web applications written using Dancer can be deployed easily in a number of ways, including as standalone scripts. Dancer works well with Perl’s Template::Toolkit for HTML generation.

I propose a presentation putting these elements together to create a simple interface to the National Income Accounts data provided by the Bureau of Economic Analysis :

  • A backend that puts the data in an easily queryable format,
  • A simple web application that presents a straightforward UI which enables the visitor select components of the data set to plot and generates the data table and the HTML document using Template::Toolkit
  • Client-side scripting to visualize the data.

None of this is particularly complicated, but I am not aware of any tutorials or documentation that would help someone with reasonable familiarity with all the technologies involved to put together such an application. Therefore, an example of such a self-contained web application might be of interest.

Of course, these building blocks can be used to provide interfaces to data from other domains than Economics as well.

Photo of A.Sinan Unur

A.Sinan Unur


Sinan Unur is an economist by training and currently works as an independent programmer and consultant helping his clients make sense of large and complicated data sets.

He earned his Ph.D. in Consumer Economics at Cornell University where he worked as a Senior Lecturer until 2009, teaching Economics and Statistics to graduate and undergraduate students. Unur’s passion for Perl dates back about ten years to when he decided to switch from Java to Perl as his tool of choice for writing Economics experiments. He is an active contributor to the Perl tag on Stackoverflow and maintains Perl’s Crypt::SSLeay and Net::Sharktools modules on CPAN.

Comments on this page are now closed.


Joshua Keroes
07/29/2011 9:25am PDT

I’m most interested in solving problems. Too much time was spent showing that there was data on the web in several different formats and complaining that it’s hard to work with.

I was there to see the solutions to the finding and fetching problem, offering indexes to users, munging the various formats, leveraging datasets against one another, and how it was all realized visually.

Shawn Page
07/29/2011 8:26am PDT

I felt that there was way too much time spent on the graphs and why embedded graphs are bad. In the end I felt as if we were told that his experiment was a bad idea, that canvas is not good for drawing conceptual stuff and that svg is better. I guess I expected more of a walkthrough on how to use perl with HTML5 Canvas.

Mark Deason
07/28/2011 5:51pm PDT

Supporting materials are great, however you should download them prior to presentation. Sorry I can’t help you with your problems, I was expecting you to help me with mine. Finally got to the point… canvas is not ready for prime time.