Line Chart
1. Add this line to your application's Gemfile:
# ======= Chart ========
gem 'chartkick'
gem 'groupdate'
gem 'chartkick'
gem 'groupdate'
2. After run the bundle install
3. Sprockets, in
app/assets/javascripts/application.js
, add:
//= require chartkick
//= require Chart.bundle
//= require Chart.bundle
4. For View Page :-
<%= line_chart User.group_by_day(:created_at).count %>
<%= line_chart Order.all.group_by_day() { |order| order.created_at
}.map{ |date, orders, | [date, orders.size] }
%>