Project

db_graph

0.0
No commit activity in last 3 years
No release in over 3 years
AR generate beautiful graphs from date fields, in 1 LOC
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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...