Skip to content
Easy graphs from AR date fields
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
exmaples
lib/db_graph
spec
.gitignore
README.markdown
Rakefile
VERSION
db_graph.gemspec

README.markdown

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

Examples

Weeks and months
weeks months

Install

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

Usage

DBGraph::Line.url(: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...

TODO

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

Author

Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...

You can’t perform that action at this time.