Giter Club home page Giter Club logo

ezgraphix's Introduction

EZGraphix

Documentation

API Documentation

Demo

Online Demo

Installation Notes

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!.

Usage

In your Controller:

For single series charts:

def index
  @g = Ezgraphix::Graphic.new
  @g.data = {:ruby => 1, :perl => 2, :smalltalk => 3}
end

or you can specify the data directly in the constructor:

def index
  @g = Ezgraphix::Graphic.new(:data => {:ruby => 1, :perl => 2, :smalltalk => 3})
end

For multiseries charts:

In this case you have multiple values for each serie. Also you need to specify categories (labels). In the example below there are 2 series “Registrations” and “Payments” and values are divided into 7 months (labels) with a value for each serie/month.

def index
  @g = Ezgraphix::Graphic.new
  @g.data = { "Registrations" => [4,2,12,7,0,3,6], "Payments" => [7,3,5,2,1,0,9] }
  @g.labels = ["March", "April", "May", "June", "July", "August", "September"]
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'
Area 2D   => :c_type => 'area2d'
Pie 2D	  => :c_type => 'pie2d'
Pie 3D	  => :c_type => 'pie3d'
Line	  => :c_type => 'line'
Doughnut 2D  => :c_type => 'doug2d'
MultiSeriesLine => :ctype => 'msline'
MultiSeriesColumn3D => :ctype => 'mscol3d'
MultiSeriesColumn2D => :ctype => 'mscol2d'
MultiSeriesArea2D => :ctype => 'msarea2d'
MultiSeriesBar2D => :ctype => 'msbar2d'

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 %>

or just

<%= @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!.

EZGraphix

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!

LICENSE:

(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.

ezgraphix's People

Contributors

dcaliri avatar febuiles avatar jpemberthy avatar valo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.