-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
31 lines (23 loc) · 1.44 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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!