Graphing NetNewsWire With the Google Chart API
There’s a nice Ruby wrapper for the Google Chart API. Here’s that NetNewsWire group attention chart using it:
<p>[sourcecode language=‘ruby’]
!/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\.getend
puts pc.to_url
[/sourcecode]
</p>“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:
<div style="text\-align:center;"></div>And here it is doing the Safari views-per-day history:
<div style="text\-align:center;"></div>#google charts #netnewswire #ruby