<% flash.each do |type, msg| %>
<%= msg %>
<% end %> <% if flash.any? %>
<% end %>

Chartkick

Create beautiful JavaScript charts with one line of Ruby

Chartkick is a simple, yet powerful library for creating beautiful charts with one line of Ruby. It is built on top of the Chart.js library.

Line Chart



<%= line_chart Person.group_by_day(:updated_at).count %>

Pie Chart via Query



<%= pie_chart Yogurt.group(:flavour).count %>

Pie Chart (Manual)



<%= pie_chart [ ['Task', 'Hours per Day'], ['Work',11], ['Eat',2], ['Commute',2], ['Watch TV', 2], ['Sleep',7] ] %>

Column Chart



<%= column_chart Person.group_by_hour_of_day(:updated_at, format: "%l %P").count %>