With Rails Admin
If you are using RailsAdmin for managing you web-application from backend, you get reports for your data out of the box. In addition you can edit/update in no time with ease. You will not have charts and graph at that instant though.
How can I get Charts?
Yes there are some Rails-Admin plugins to help you out. My favorite is RailsAdmin Charts.
With Rails Admin Charts
The default chart is Line Chart. For Pie charts the data format. Since this gem uses ‘Lazy High charts‘ for chart generation, we can find chart specific data arrangement technique from there.
For pie data format should be like
class Contractor < ActiveRecord::Base include RailsAdminCharts ... def self.graph_data(since = 30.days.ago) Contractor.group(:state).count.to_a # Output # [["Bagmati", 3], ["Gandaki", 3], ["Janakpur", 5]] end def self.chart_type 'pie' end end
In this example I wanted to show all the contractors count by States.