Protovis Charting Rails plugin
Switch branches/tags
Nothing to show
Pull request Compare This branch is even with ciaranj:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
javascripts
lib
CHANGELOG
CONTRIBUTORS
LICENSE
README
TODO
init.rb
install.rb

README

A *very* rough'n'ready Rails plugin that allows relatively trivial integration of the Protovis ( http://vis.stanford.edu/protovis/ ) javascript
chart rendering API into a Rails project.

The usage is relatively simple, install it as a git submodule:
	git submodule add git://github.com/ciaranj/redmine.git vendor/plugins/protovisonrails
	
There is an includes helper ( protovis_includes ) that allows you to automatically pull in these javascript files.

This now provides a minimal object model for constructing these protovis charts/panels using Ruby, for example:

panel=Panel.new(:name=> 'panel', :width=> 150, :height => 150 )
bar= Bar.new(:name=> 'bar', 
           :width=> 20,
           :bottom=> 0, 
           :height=> "function(d) d * 50",
           :left => "function() this.index * 25",
           :data => [1, 1.2, 1.7, 1.5, 0.7])
         
panel.add( bar )
bar2= Bar.new(:name=> 'bar2', 
          :data => [0.5, 1, 0.8, 1.1, 1.3],
          :bottom => "function() bar.height() + bar.bottom()"
          )
bar.add( bar2)

Will construct a model that can be used in your view as follows: 

<%= render_protovis_panel(panel) %>
	
The intention is to provide more of a useful object model to build these objects up programatically. Currently all of these charts ( http://vis.stanford.edu/protovis/api/Bar.html ) 
can be re-produced (and are in fact reproduced in the test renderer  <%=render_protovis_tests%>)  The API is most definately subject to change!