Visualizing Human Rights with the Google Charts API

June 20, 2008

Smartly presented information is a nonprofit's best friend. If you can't communicate the problem, no one is going to give a damn. Hash's blog just pointed me to some powerful charts Sokwanele mapping project , which I've mentioned previously. These charts are extremely important data to have in the public domain, and it's great that they appear well-executed and polished, with a high resolution of visual information.

pretty charts, not so pretty data.

Google Charts from Sokwanele and Mobile Researcher

The charts at Mobile Researcher also caught my eye recently (also pictured, at right and bottom). Turns out they were both made with Google Charts. I hadn't used it before, but I recognized their densely set labels and had some vague ideas that there was a Ruby wrapper. And I just thought that the Mobile Researcher charts were really beautiful. Turns out it's super easy. There are plenty of libraries for managing the requests to the API, and, in some simple cases you can even code it by hand, since all of the code is simply passed through a query tag on an image url.

What it does do is proved fodder for organizations inside and out to make an even stronger case against this repressive regime. - Erik Hersman @
But in most of the cases the data is hashed somehow with javascript, since urls can only be so long. Since I was working in a Rails app, I used a great ruby library and was up and running very quickly. I wholeheartedly recommend them anytime you need simple, sharp graphics to illustrate your research. If you have a web app or with dynamic charts, it's a no-brainer, since generating images is relatively intensive memory-wise.

All this is to say that something like this:

  <img src=",2,6,4,2,4,7,3,4,2,3,4 &chco=0077CC&chs=120x40&cht=ls" />;

Turns into this:


Or you can abstract the access to make it easier with a library like this with a method like this:

    google_pie('val1', 'val2', 'val3')
    def google_pie(*args)
    size = "250x100"
    url  = ""
    return < img src=\"#{Gchart.pie_3d( :background => 'E9E7DD', :size => '300x80', :data => *args)} \" />

But the API of course is language neutral, and I am sure it would be just as easy in most any language. Oh, and it's free! (Though capped at 10k charts per day ... which would be a good problem to have, I suppose.)