Gem/Rails plugin to generate graphs from all your date fields, beautifully simple and combineable.


Weeks and months
weeks months


As Gem: sudo gem install db_graph

Or as Rails plugin: sudo gem install gchartrb ./script/plugins install git://


DBGraph::Line.url(:weeks, User, :created_at, :at=>

Or instance interface for multiple lines #everything g =

#selected interval (:at is expanded to a interval, here: 2009-2010)
g =, :at=>Time.parse('2009-01-02'), :show_legend=>false)

g.add(User, :created_at)
g.add(Item, :sold_at, :label=>'Things we sold')
g.add(Product, :sold_at, :conditions=>['merchandise = ?',false])
g.to_url --> google chart url with all your data as line graph

We got :minutes, :hours, :days, :weeks, :months and seconds/years can be added if someone needs them...


  • weeks/months from beginning of data (->all years)


Michael Grosser
Hereby placed under public domain, do what you want, just do not hold me accountable...