Skip to content

Instantly share code, notes, and snippets.

@djudd
Created November 2, 2012 22:52
Show Gist options
  • Save djudd/4004848 to your computer and use it in GitHub Desktop.
Save djudd/4004848 to your computer and use it in GitHub Desktop.
really simple Ruby Googlecharts graph
require 'gchart'
require 'json'
data = JSON.parse(IO.read('google-hit-results.json'))['result']
totals = data.collect { |point| point['count'] }
labels = data.collect do |point|
point['_id']['date']['day']
end
chart = Gchart.line(
:data => [totals, works, profiles, rank],
:labels => labels,
:legend => ['Google Hits'],
:theme => :pastel,
:format => 'file',
:size => '600x400'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment