Gem/Rails plugin to generate graphs from all your date fields, beautifully simple and combineable.
Weeks and months
As Gem: sudo gem install db_graph
Or as Rails plugin: sudo gem install gchartrb ./script/plugins install git://github.com/grosser/db_graph.git
::.(:weeks, User, :created_at, :at=>Time.now)
Or instance interface for multiple lines #everything g = DBGraph::Line.new(:weeks)
#selected interval (:at is expanded to a interval, here: 2009-2010) g = DBGraph::Line.new(:weeks, :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)