quick-graph / 0.3
| Short description: | Simple bar graph library that doesn't rely on an image library. | ||||||
|---|---|---|---|---|---|---|---|
| Category: | Library/Graph | ||||||
| Status: | stable | ||||||
| Created: | 2005-11-26 09:37:39 GMT | ||||||
| Last update: | 2005-11-26 09:41:19 GMT | ||||||
| Owner: | Nicholas Wright (Projects of this owner) | ||||||
| Homepage: | http://pi.railsplayground.com/graph/ | ||||||
| Download: | http://pi.railsplayground.com/ruby/quick_graph.rb | ||||||
| License: | Ruby's | ||||||
| Dependency: |
|
||||||
| Description: | DescriptionQuickGraph is a very simple to use bar graph class that creates (highly?) customizable horizontal or vertical bar graphs with little to no effort. The graphs generated via this class are pure html and require no external dependencies. ExamplesNote: examples are more geared towards rails usage vertical graph with labels
data = Traffic.find(:all, :select => "visits, date", :order => "id desc", :limit => 30)
total = data.collect {|i| i.visits}.inject {|tmp, j| tmp + j}
graph = QuickGraph.new(400, 300, total, "white", "Hover to view traffic for it's respective day")
@vertical = graph.vertical(data.collect {|o| {:size => o.visits, :label => "#{o.visits} visitors on #{o.date}"}})
horizontal graph without labels
graph = QuickGraph.new(100, 100, 100)
@horizontal = graph.horizontal([{:size => 30, :color => "maroon"},
{:size => 29, :color => "yellow"},
{:size => 41, :color => "purple"}])
Miscellaneous
Questions, suggestions and comments very much appreciated. I hope this code is of use to somebody. |
||||||