Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Bar Chart is a gem for creating bar charts (duh!). It uses D3 (Data Driven Documents) to aggregate the data and render the SVG awesomeness.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
templates
test
.gitignore
.travis.yml
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
igs_bar_chart.gemspec

README.md

IGS Bar Chart

Build Status Dependency Status Code Climate

Bar Chart is a gem for generating bar charts (duh). It uses D3 (Data Driven Documents) to aggregate the data and render SVG awesomeness into an HTML element of your choosing.

Bar Chart is part of the Innovative Graph Suite.

Bar Chart is not production ready yet, although it works fine.

The RDoc is not available yet, but there are few files to peek and the test shows how it works.

Requirements

Ruby and Rails

This gem is tested against the latest version of RoR, other versions are not our focus now. Rails is not really needed, but apparently our main dependency 'd3_rails' requires you to install all Rails gems, we will work on that in the future.

D3 (Data Driven Documents)

This gem uses the awesomeness of D3, a great way to work with data, and data visualization too. So, remember you need the D3 js file available.

SVG

The graphics generated to bring pies to life are based on SVG, all browsers should fully support SVG and its transitions but some do not, be aware of that.

Installation

IGS Bar Chart is distributed as a gem, which is how it should be used in your app.

Include the gem in your Gemfile:

gem "igs_bar_chart"

Or, if you want to get the bleeding edge, you can get master from the main repository:

gem "igs_bar_chart", :git => "git://github.com/lucasmartins/igs_bar_chart.git"

Usage (Rails)

Add D3 to your Rails javascript manifest (application.js):

//= require d3

Make your pie (controller):

@bar = Igs::BarChart.new('The Favorite Pizzas Chart',200,0.4,'body',{'Mussarela'=>25,'Brocolli'=>25,'Pepperoni'=>50})

Savor it raw (view):

<%= raw @bar.render %>

Done!

You can also render specific parts of the @bar, like in:

<%= raw @bar.style #css %>
<%= raw @bar.script #javascript %>
<%= raw @bar.labels #ul+li %>

Breakdown

Igs::BarChart.new(size,endomargin=0,target_element='body',data)
  size => "Integer, Your X and Y measures"
  endomargin => "Float, from 0 to 1, represents the internal margin, 0 for Pizza Pie, 0.5 for a nice Donut."
  target_element => "String, the target HTML element where the chart will be rendered."
  data => "Hash with the labels and floats which represents each slice of the Pizza/Donut."

Contributing

This gem is in a very early stage.

If you'd like to contribute a feature or bugfix: Thanks! To make sure your fix/feature has a high chance of being included, please post a new GitHub Issue

License

IGS Bar Chart is free software under the MIT license .

Something went wrong with that request. Please try again.