Rails Active Admin + Chartkick = Not working?
Don't forget to add #= require chartkick
to active_admin.js.coffee
.
To render a chart in AA dashboard, go with:
div class: 'custom-class' do
h3 'Your name for a chart'
@metric = Model.group(:attribute).count # whatever data you pass to chart
render partial: 'metrics/partial_name', locals: {metric: @metric}
end
This file
partial: 'metrics/partial_name'
lays under app/views/metrics/partial_name
directory, and could have the following structure:
_partial_name.html.haml
:
= javascript_include_tag "//www.google.com/jsapi", "chartkick"
= pie_chart metric
Having this you should be ok with using chartkick.