README.md in reports_kit-0.2.0 vs README.md in reports_kit-0.3.0

- old
+ new

@@ -1,7 +1,9 @@ ReportsKit ===== +[![Build Status](https://travis-ci.org/tombenner/reports_kit.svg?branch=master)](https://travis-ci.org/tombenner/reports_kit) + ReportsKit lets you easily create beautiful charts with customizable, interactive filters. For interactive examples, see [reportskit.co](https://www.reportskit.co/). --- @@ -61,40 +63,32 @@ ``` Quick Start ----------- -After installation, you can create your first chart with a single line! +After installation, you can create your first chart with just a YAML file and a single line in any view. -In any view, create a chart that shows the number of records of a model (e.g. `user`) created over time: +Configure the chart in the YAML file: -`app/views/users/index.html.haml` -```haml -= render_report measure: { key: 'user', dimensions: ['created_at'] } -``` - -You're done! `render_report` will render the following chart: - -[<img src="docs/images/users_by_created_at.png?raw=true" width="500" />](docs/images/users_by_created_at.png?raw=true) - -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` ```yaml -measure: - key: user - dimensions: - - created_at +measure: user +dimensions: +- created_at ``` +Then pass that filename to `render_report` in a view: + `app/views/users/index.html.haml` ```haml = render_report 'my_users' ``` -The YAML approach is more maintainable and readable, so we'll use it in the rest of the documentation. +You're done! `render_report` will render the following chart: +[<img src="docs/images/users_by_created_at.png?raw=true" width="500" />](docs/images/users_by_created_at.png?raw=true) + ### 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` @@ -107,10 +101,14 @@ Many other form controls are available; see [Filters](docs/filters.md) for more. ### How It Works -In the Quick Start chart, `key: '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. +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 group the counts by week (the granularity is configurable), sort them chronologically, and add in zeros for any missing weeks. + +ReportsKit infers sane defaults from your ActiveRecord model configurations. If there was a `belongs_to :company` association on `User` and you used `dimensions: ['company']`, then ReportsKit would count users grouped by the `company_id` column and show company names on the x-axis. + +If you need more customization (e.g. custom filters, custom dimensions, custom aggregation functions, custom orders, aggregations of aggregations, etc), ReportsKit is very flexible and powerful and supports all of these with a simple syntax. It lets you use SQL, too. To learn how to use more of ReportsKit's features, check out the following resources: * [Examples](https://www.reportskit.co/) * [Documentation](docs)