ReportsKit
ReportsKit lets you easily create beautiful charts with customizable, interactive filters.
Add powerful reporting to your Rails app in minutes, not months!
For interactive examples, see reportskit.co.
- Quick setup - Install ReportsKit and create your first chart in less than one minute using just ~5 lines of code.
- Simple chart configuration - Create charts using your existing Rails models. ReportsKit examines the column types and associations to understand how to render the chart.
- Powerful results - To see what ReportsKit can create with minimal code, see reportskit.co.
Resources
Installation
In Gemfile:
gem 'reports_kit'
In app/assets/stylesheets/application.css.scss:
*= require reports_kit/application
In app/assets/javascripts/application.js:
//= require reports_kit/application
In config/routes.rb:
Rails.application.routes.draw do
mount ReportsKit::Engine, at: '/'
# ...
end
Quick Start
After installation, you can create your first chart with a single line!
In any view, create a chart that shows the number of records of a model (e.g. user) created over time:
app/views/users/index.html.haml
= render_report measure: 'user', dimensions: ['created_at']
You're done! render_report will render the following chart:
Instead of passing a hash to render_report, you can alternatively configure your charts using YAML and then pass the filename to render_report:
config/reports_kit/reports/my_users.yml
measure: user
dimensions:
- created_at
app/views/users/index.html.haml
= render_report 'my_users'
The YAML approach is more maintainable and readable, so we'll use it in the rest of the documentation.
Form Controls
You can add a date range form control to the above chart with a single line, using one of ReportsKit's form helpers:
app/views/users/index.html.haml
= render_report 'my_users' do |f|
= f.date_range :created_at
Many other form controls are available; see Filters for more.
How It Works
In the Quick Start chart, measure: 'user' tells ReportsKit to count the number of User records, and dimensions: ['created_at'] tells it to group by the week of the created_at column. Since created_at is a datetime column, ReportsKit knows that it should sort the results chronologically.
To learn how to use more of ReportsKit's features, check out the following resources:
License
ReportsKit is released under the MIT License. Please see the MIT-LICENSE file for details.








