Skip to content

Instantly share code, notes, and snippets.

@picatz
Created February 19, 2017 14:13
Show Gist options
  • Save picatz/8ee9cb9f1e2f15220600d80edf355fc3 to your computer and use it in GitHub Desktop.
Save picatz/8ee9cb9f1e2f15220600d80edf355fc3 to your computer and use it in GitHub Desktop.
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 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment