Skip to content


Subversion checkout URL

You can clone with
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.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

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.


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.


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.


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://"

Usage (Rails)

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

//= require d3

Make your pie (controller):

@bar ='The Favorite Pizzas Chart',200,0.4,'body',{'Mussarela'=>25,'Brocolli'=>25,'Pepperoni'=>50})

Savor it raw (view):

<%= raw @bar.render %>


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

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

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


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


IGS Bar Chart is free software under the MIT license .

Something went wrong with that request. Please try again.