Gemlist:
#Gemfile
gem 'groupdate'
gem "chartkick"
执行$ bundle install
#config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
config.register_javascript 'https://www.gstatic.com/charts/loader.js'
end
# app/assets/javascripts/active_admin.js.coffee
#= require active_admin/base
#= require chartkick
$ rails g active_admin:page StuUserChart
Running via Spring preloader in process 87926
create app/admin/stu_user_chart.rb
# app/admin/stu_user_chart.rb
ActiveAdmin.register_page "StuUserChart" do
content do
#para column_chart [["2016-01-01", 30], ["2016-02-01", 54]], stacked: true, library: {colors: ["#D80A5B", "#21C8A9", "#F39C12", "#A4C400"]}
para line_chart StuUser.group_by_day(:created_at).count
end
end