Skip to content

Instantly share code, notes, and snippets.

@picatz
Created February 19, 2017 14:56
Show Gist options
  • Save picatz/f68484f720ddd8ec3cac0e915fb56d50 to your computer and use it in GitHub Desktop.
Save picatz/f68484f720ddd8ec3cac0e915fb56d50 to your computer and use it in GitHub Desktop.
require "pi_charts"
# create a new line chart
chart = PiCharts::Line.new
# add labels ( x values )
chart.add_labels(["January", "February", "March", "April", "May"])
# add datasets
chart.add_dataset(label: "cats", data: [3, 1, 3, 3, 7])
chart.add_dataset(label: "dogs", data: [7, 3, 3, 1, 3])
# neat 'lil configurations
chart.hover
chart.responsive
# generate html / js for chart
puts chart.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment