Skip to content

ciaranj/protovisonrails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Protovis Charting Rails plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published