Install the plugin:
script/plugin install git://github.com/jpemberthy/ezgraphix.git
Run the tasks: (it will move the necessary files to use the plugin)
rake ezgraphix:setup # run from your project's root
After the installation include the FusionCharts.js in each layout that will render ezgraphix:
<%= javascript_include_tag "FusionCharts" %>
and that’s it!.
In your Controller:
def index @g = Ezgraphix::Graphic.new @g.data = {:ruby => 1, :perl => 2, :smalltalk => 3} end
There are 2 ways to pass render options:
1. When the Graphic object is created, you can define it also as:
@g = Ezgraphix::Graphic.new(:w => 200, :h => 300, :c_type => 'bar3d', :div_name => 'my_chart_tag_name')
The defaults are:
{:c_type => ‘col3d’, :w => 300, :h => 300, :div_name => ’ez_graphic’}
At the moment, you can render the following graphics:
Column 2D => :c_type => 'col2d' Column 3D => :c_type => 'col3d' Bar 2D => :c_type => 'bar2d' Pie 2D => :c_type => 'pie2d' Pie 3D => :c_type => 'pie3d' Line => :c_type => 'line' Doughnut 2D => :c_type => 'doug2d'
2. Anytime you want, by accessing the render_options attribute.
@g.render_options(:caption => 'cool languages', :w => 400) #Merges new options with the last configuration.
In your view.
Add the following line wherever you want to render the graphic.
<%= render_ezgraphix @g %>
Tests
rake spec #run from the plugin's root
Note.
Full set of render_options are specified in the rdoc, and more chart’s support will be included soon!.
A Ruby gem to generate flash based graphics for rails applications using a free and customizable chart’s set.
Copyright © 2008 Juan Esteban Pemberthy, released under the MIT License.
EzGraphix uses FusionCharts Free, It’s license is specified in the FusionChartsFreeLICENSE file.
Fork and feel free to contribute!
(The MIT License)
Copyright © 2008 Juan Esteban Pemberthy
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
‘Software’), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.