Graphing NetNewsWire With the Google Chart API
January 8th, 2009 | Published in ruby
There’s a nice Ruby wrapper for the Google Chart API. Here’s that NetNewsWire group attention chart using it:
#!/usr/bin/ruby
require 'rubygems'
require 'appscript'
require 'google_chart'
include Appscript
nnw = app("NetNewsWire")
unwanted_groups = ["Clippings", "Mobile", "Flagged Items", "Latest News", "monitors", "miscfeeds"]
groups = nnw.subscriptions[its.is_group.eq(true)].get
groups.reject!{|g| unwanted_groups.include?(g.display_name.get) }
pc = GoogleChart::PieChart.new('500x200', "Groups", false)
groups.each do |s|
pc.data s.display_name.get, s.calculated_attention_score.get
end
puts pc.to_url
“pc.to_url” yields:
http://chart.apis.google.com/chart?chtt=Groups&chd=s:9ieaHBA&cht=p&chl=mma|mac|blogs|politics|web|people_blogs|news&chs=500x200
which produces this:

And here it is doing the Safari views-per-day history:

