Skip to content

Pie Chart is a gem for pizza making. It uses D3 (Data Driven Documents) to aggregate the data and render the SVG awesomeness.

License

Notifications You must be signed in to change notification settings

lucasmartins/igs_pie_chart

Repository files navigation

IGS Pie Chart

Code Climate Build Status Dependency Status

Pie Chart is a gem for pizza/donut (charts) making. It uses D3 (Data Driven Documents) to aggregate the data and render SVG awesomeness into an HTML element of your choosing.

Pie Chart is the first piece of the Innovative Graph Suite, different ways to visualize your data will be available in the near future.

Pie 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 Pie Chart is distributed as a gem, which is how it should be used in your app.

Include the gem in your Gemfile:

gem "igs_pie_chart"

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

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

Usage (Rails)

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

//= require d3

Make your pie (controller):

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

Savor it raw (view):

<%= raw @pie.render %>

Done!

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

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

Breakdown

Igs::PieChart.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."

Contributors

Innovit

IGS Pie Chart was bootstrapped inside Innovit LTDA

Special thanks to Andrik, for pushing the company to a more open perspective.

The names and logos for Innovit are trademarks of Innovit LTDA.

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 Pie Chart is free software under the MIT license.

About

Pie Chart is a gem for pizza making. It uses D3 (Data Driven Documents) to aggregate the data and render the SVG awesomeness.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages