LoginSignup
1
2

More than 5 years have passed since last update.

ActiveAdminでchartkickを使う

Last updated at Posted at 2015-09-16

Charkickは、Rubyでグラフを書くライブラリ

WebSite:
http://chartkick.com/

Github:
https://github.com/ankane/chartkick

インストール

gem "chartkick"
$ bundle install

設定

config/initializers/active_admin.rb

googleの場合

active_admin.rb
ActiveAdmin.setup do |config|
  config.register_javascript "http://www.google.com/jsapi"
  config.register_javascript "chartkick.js"
end

highchartsの場合

active_admin.rb
ActiveAdmin.setup do |config|
  config.register_javascript "http://code.highcharts.com/highcharts.js"
  config.register_javascript "chartkick.js"
end

プリコンパイル

$ ./bin/rake assets:precompile

サンプル

index.erb
pie_chart Model.group(:status).count
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2