Pi Charts is a ruby gem to easily generate beautiful charts using chartjs πβπβππ©
$ gem install pi_charts
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 }
The gem is available as open source under the terms of the MIT License.
Kent 'picat' Gruber