picatz / Pi-Charts

A ruby gem to easily build beautiful charts using chartjs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pi Charts

Pi Charts is a ruby gem to easily generate beautiful charts using chartjs πŸ“ˆβ—•πŸ“Šβ—”πŸ“‰πŸ©

⚠️ This gem is install in development. Things may change to be better in the future.

Installation

$ gem install pi_charts

Usage

Pi Charts is a really good pair with something like sinatra, for example:

require 'sinatra'
require 'pi_charts'

def bake_pie
  chart = PiCharts::Pie.new
  chart.add_dataset(label: "cats", data: 80)
  chart.add_dataset(label: "dogs", data: 50)
  chart.hover
  chart.responsive
  "<head>" + chart.cdn + "</head>" + "<body>" + chart.html(width: 60) + "</body>"
end

get('/serve_pie') { bake_pie }

Screen Shots

fresh pie

bar

line

License

The gem is available as open source under the terms of the MIT License.

Author

Kent 'picat' Gruber

About

A ruby gem to easily build beautiful charts using chartjs.

License:MIT License


Languages

Language:Ruby 99.3%Language:Shell 0.7%