reports_kit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.rubocop.yml +83 -0
  4. data/Gemfile +3 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +468 -0
  7. data/Rakefile +2 -0
  8. data/app/assets/javascripts/reports_kit/application.js +14 -0
  9. data/app/assets/javascripts/reports_kit/lib/_init.js +8 -0
  10. data/app/assets/javascripts/reports_kit/lib/chart.js +39 -0
  11. data/app/assets/javascripts/reports_kit/lib/report.js +119 -0
  12. data/app/assets/javascripts/reports_kit/vendor/chart.js +12269 -0
  13. data/app/assets/javascripts/reports_kit/vendor/daterangepicker.js +1627 -0
  14. data/app/assets/javascripts/reports_kit/vendor/moment.js +4040 -0
  15. data/app/assets/javascripts/reports_kit/vendor/select2.full.js +6436 -0
  16. data/app/assets/stylesheets/reports_kit/application.css.scss +3 -0
  17. data/app/assets/stylesheets/reports_kit/reports.css.sass +7 -0
  18. data/app/assets/stylesheets/reports_kit/select2_overrides.css.sass +7 -0
  19. data/app/assets/stylesheets/reports_kit/vendor/daterangepicker.css +269 -0
  20. data/app/assets/stylesheets/reports_kit/vendor/select2-bootstrap.css +721 -0
  21. data/app/assets/stylesheets/reports_kit/vendor/select2.css +484 -0
  22. data/config/routes.rb +10 -0
  23. data/docs/images/chart_options.png +0 -0
  24. data/docs/images/dashed_line.png +0 -0
  25. data/docs/images/flights_by_carrier.png +0 -0
  26. data/docs/images/flights_by_carrier_and_flight_at.png +0 -0
  27. data/docs/images/flights_by_delay.png +0 -0
  28. data/docs/images/flights_by_flight_at.png +0 -0
  29. data/docs/images/flights_by_hours_delayed.png +0 -0
  30. data/docs/images/flights_with_check_box.png +0 -0
  31. data/docs/images/flights_with_configured_boolean.png +0 -0
  32. data/docs/images/flights_with_configured_datetime.png +0 -0
  33. data/docs/images/flights_with_configured_number.png +0 -0
  34. data/docs/images/flights_with_configured_string.png +0 -0
  35. data/docs/images/flights_with_date_range.png +0 -0
  36. data/docs/images/flights_with_filters.png +0 -0
  37. data/docs/images/flights_with_multi_autocomplete.png +0 -0
  38. data/docs/images/flights_with_string_filter.png +0 -0
  39. data/docs/images/horizontal_bar.png +0 -0
  40. data/docs/images/legend_right.png +0 -0
  41. data/docs/images/users_by_created_at.png +0 -0
  42. data/gists/doc.txt +58 -0
  43. data/lib/reports_kit.rb +17 -0
  44. data/lib/reports_kit/base_controller.rb +11 -0
  45. data/lib/reports_kit/configuration.rb +10 -0
  46. data/lib/reports_kit/engine.rb +21 -0
  47. data/lib/reports_kit/helper.rb +19 -0
  48. data/lib/reports_kit/model.rb +16 -0
  49. data/lib/reports_kit/model_configuration.rb +23 -0
  50. data/lib/reports_kit/rails.rb +5 -0
  51. data/lib/reports_kit/report_builder.rb +76 -0
  52. data/lib/reports_kit/reports/data/chart_options.rb +132 -0
  53. data/lib/reports_kit/reports/data/generate.rb +65 -0
  54. data/lib/reports_kit/reports/data/one_dimension.rb +71 -0
  55. data/lib/reports_kit/reports/data/two_dimensions.rb +129 -0
  56. data/lib/reports_kit/reports/data/utils.rb +79 -0
  57. data/lib/reports_kit/reports/dimension.rb +78 -0
  58. data/lib/reports_kit/reports/filter.rb +84 -0
  59. data/lib/reports_kit/reports/filter_types/base.rb +47 -0
  60. data/lib/reports_kit/reports/filter_types/boolean.rb +30 -0
  61. data/lib/reports_kit/reports/filter_types/datetime.rb +27 -0
  62. data/lib/reports_kit/reports/filter_types/number.rb +28 -0
  63. data/lib/reports_kit/reports/filter_types/records.rb +26 -0
  64. data/lib/reports_kit/reports/filter_types/string.rb +38 -0
  65. data/lib/reports_kit/reports/generate_autocomplete_results.rb +55 -0
  66. data/lib/reports_kit/reports/inferrable_configuration.rb +113 -0
  67. data/lib/reports_kit/reports/measure.rb +58 -0
  68. data/lib/reports_kit/reports_controller.rb +15 -0
  69. data/lib/reports_kit/resources_controller.rb +8 -0
  70. data/lib/reports_kit/version.rb +3 -0
  71. data/reports_kit.gemspec +23 -0
  72. data/spec/factories/issue_factory.rb +4 -0
  73. data/spec/factories/issues_label_factory.rb +4 -0
  74. data/spec/factories/label_factory.rb +4 -0
  75. data/spec/factories/repo_factory.rb +5 -0
  76. data/spec/factories/tag_factory.rb +4 -0
  77. data/spec/fixtures/generate_inputs.yml +35 -0
  78. data/spec/fixtures/generate_outputs.yml +208 -0
  79. data/spec/reports_kit/reports/data/generate_spec.rb +275 -0
  80. data/spec/reports_kit/reports/dimension_spec.rb +38 -0
  81. data/spec/reports_kit/reports/filter_spec.rb +38 -0
  82. data/spec/spec_helper.rb +58 -0
  83. data/spec/support/factory_girl.rb +5 -0
  84. data/spec/support/helpers.rb +13 -0
  85. data/spec/support/models/issue.rb +6 -0
  86. data/spec/support/models/issues_label.rb +4 -0
  87. data/spec/support/models/label.rb +5 -0
  88. data/spec/support/models/repo.rb +7 -0
  89. data/spec/support/models/tag.rb +4 -0
  90. data/spec/support/schema.rb +38 -0
  91. metadata +232 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e3abddaccea88828c06d6e0ff3131c56fba4dc20
4
+ data.tar.gz: 990fa98bba536c8334020fde32d5c202dea92f9b
5
+ SHA512:
6
+ metadata.gz: c92b9aca0da9517597d63a21f461e7f29229a29b33f6598f24858e08401c11431846904de22bc305b246f095b5ed5e27fe51ba86b676e3db35844e7bffa6bac8
7
+ data.tar.gz: fe4f821935c7301266574d7ee973882a9cf3c7162e67f3c400b774b4867a8c7e82e0269ea6af11d102a2d79c1d9d110ea7bd6cca9ebfa1b927ab2ef905e0f1ad
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ Gemfile.lock
3
+ *.gem
4
+ log/*.log
5
+ .bundle/
6
+ pkg/
data/.rubocop.yml ADDED
@@ -0,0 +1,83 @@
1
+ # inherits from https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - spec/support/schema.rb
6
+ - bin/**/*
7
+ - tmp/**/*
8
+ - vendor/**/*
9
+ - .bundle/**/*
10
+ Rails:
11
+ Enabled: true
12
+ DisplayCopNames: true
13
+ DisplayStyleGuide: true
14
+
15
+ Documentation:
16
+ Enabled: false
17
+
18
+ Metrics/AbcSize:
19
+ Enabled: true
20
+ Max: 40
21
+ Metrics/BlockLength:
22
+ Exclude:
23
+ - spec/**/*
24
+ Metrics/CyclomaticComplexity:
25
+ Enabled: true
26
+ Max: 12
27
+ Metrics/LineLength:
28
+ Enabled: true
29
+ Max: 140
30
+ Metrics/PerceivedComplexity:
31
+ Enabled: true
32
+ Max: 12
33
+ Metrics/ClassLength:
34
+ Enabled: true
35
+ CountComments: false
36
+ Max: 200
37
+ Metrics/ModuleLength:
38
+ CountComments: false
39
+ Max: 200
40
+ Enabled: true
41
+ Metrics/MethodLength:
42
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
43
+ Enabled: true
44
+ CountComments: false
45
+ Max: 50
46
+ Metrics/ParameterLists:
47
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
48
+ Enabled: true
49
+ Max: 5
50
+ CountKeywordArgs: true
51
+
52
+ Lint/AssignmentInCondition:
53
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
54
+ Enabled: true
55
+ AllowSafeAssignment: true
56
+ Lint/UnusedBlockArgument:
57
+ Enabled: false
58
+
59
+ Style/AccessorMethodName:
60
+ Enabled: true
61
+ Style/AlignHash:
62
+ EnforcedColonStyle: key
63
+ EnforcedHashRocketStyle: key
64
+ Style/AlignParameters:
65
+ EnforcedStyle: with_fixed_indentation
66
+ Style/Alias:
67
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
68
+ EnforcedStyle: prefer_alias_method
69
+ Style/BracesAroundHashParameters:
70
+ Exclude:
71
+ - spec/**/*
72
+ Style/CaseIndentation:
73
+ EnforcedStyle: case
74
+ SupportedStyles:
75
+ - case
76
+ - end
77
+ IndentOneStep: false
78
+ Style/RaiseArgs:
79
+ Enabled: false
80
+ Style/SignalException:
81
+ Enabled: false
82
+ Style/SpecialGlobalVars:
83
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Tom Benner
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,468 @@
1
+ ReportsKit
2
+ =====
3
+ Beautiful, interactive charts for Ruby on Rails
4
+
5
+ Table of Contents
6
+ -----------------
7
+
8
+ * [Overview](#overview)
9
+ * [Installation](#installation)
10
+ * [Usage](#usage)
11
+ * [Your First Chart](#your-first-chart)
12
+ * [Measures](#measures)
13
+ * [Dimensions](#dimensions)
14
+ * [Filters](#filters)
15
+ * [Display Options](#display-options)
16
+ * [License](#license)
17
+
18
+ Overview
19
+ --------
20
+ ReportsKit lets you easily create beautiful charts with customizable, interactive filters.
21
+
22
+ For interactive examples, see [reportskit.co](https://www.reportskit.co).
23
+
24
+ [<img src="docs/images/flights_with_filters.png?raw=true" width="500" />](docs/images/flights_with_filters.png?raw=true)
25
+
26
+ ReportsKit integrates with ActiveRecord, abstracting away complex aggregation logic to make it easy to create powerful charts and filters.
27
+
28
+ Installation
29
+ ------------
30
+
31
+ In `Gemfile`:
32
+ ```ruby
33
+ gem 'reports_kit'
34
+ ```
35
+
36
+ In `app/assets/stylesheets/application.css.scss`:
37
+ ```scss
38
+ *= require reports_kit/application
39
+ ```
40
+
41
+ In `app/assets/javascripts/application.js`:
42
+ ```js
43
+ //= require reports_kit/application
44
+ ```
45
+
46
+ In `config/routes.rb`:
47
+ ```ruby
48
+ Rails.application.routes.draw do
49
+ mount ReportsKit::Engine, at: '/'
50
+ # ...
51
+ end
52
+ ```
53
+
54
+ Usage
55
+ -----
56
+ ### Your First Chart
57
+
58
+ In any view, render a chart that shows the number of records of a model (e.g. `user`) created over time:
59
+
60
+ `app/views/users/index.html.haml`
61
+ ```haml
62
+ = render_report measure: 'user', dimensions: ['created_at']
63
+ ```
64
+
65
+ [<img src="docs/images/users_by_created_at.png?raw=true" width="500" />](docs/images/users_by_created_at.png?raw=true)
66
+
67
+ You can also configure your charts using YAML and then pass the filename to `render_report`:
68
+
69
+ `config/reports_kit/reports/my_users.yml`
70
+ ```yaml
71
+ measure: user
72
+ dimensions:
73
+ - created_at
74
+ ```
75
+
76
+ `app/views/users/index.html.haml`
77
+ ```haml
78
+ = render_report 'my_users'
79
+ ```
80
+
81
+ ### Measures
82
+
83
+ The measure is what is being counted (or aggregated). You can use any model for the measure.
84
+
85
+ For example, say we have a `Flight` model with a `flight_at` datetime column. We can chart the number of flights over time:
86
+
87
+ ```yaml
88
+ measure: flight
89
+ dimensions:
90
+ - flight_at
91
+ ```
92
+ [<img src="docs/images/flights_by_flight_at.png?raw=true" width="500" />](docs/images/flights_by_flight_at.png?raw=true)
93
+
94
+ ### Dimensions
95
+
96
+ #### Overview
97
+
98
+ The dimension is what the measure is being grouped by. You can use datetime columns, integer columns, string columns, associations, or even define custom dimensions.
99
+
100
+ For example, the chart below groups by a `carrier` association on `Flight`
101
+
102
+ ```yaml
103
+ measure: flight
104
+ dimensions:
105
+ - carrier
106
+ ```
107
+ [<img src="docs/images/flights_by_carrier.png?raw=true" width="500" />](docs/images/flights_by_carrier.png?raw=true)
108
+
109
+ You can also use two dimensions:
110
+
111
+ ```yaml
112
+ measure: flight
113
+ dimensions:
114
+ - carrier
115
+ - flight_at
116
+ ```
117
+ [<img src="docs/images/flights_by_carrier_and_flight_at.png?raw=true" width="500" />](docs/images/flights_by_carrier_and_flight_at.png?raw=true)
118
+
119
+ Dimensions can be configured using a string:
120
+
121
+ ```yaml
122
+ measure: flight
123
+ dimensions:
124
+ - carrier
125
+ ```
126
+
127
+ Or, if you need to use options, you can configure them using a hash:
128
+
129
+ ```yaml
130
+ measure: flight
131
+ dimensions:
132
+ - key: carrier
133
+ limit: 5
134
+ ```
135
+ #### Types
136
+
137
+ ##### Association
138
+
139
+ ```yaml
140
+ measure: flight
141
+ dimensions:
142
+ - carrier
143
+ ```
144
+ [<img src="docs/images/flights_by_carrier.png?raw=true" width="500" />](docs/images/flights_by_carrier.png?raw=true)
145
+
146
+ ##### Datetime Column
147
+
148
+ ```yaml
149
+ measure: flight
150
+ dimensions:
151
+ - flight_at
152
+ ```
153
+ [<img src="docs/images/flights_by_flight_at.png?raw=true" width="500" />](docs/images/flights_by_flight_at.png?raw=true)
154
+
155
+ ##### Integer Column
156
+
157
+ ```yaml
158
+ measure: flight
159
+ dimensions:
160
+ - delay
161
+ ```
162
+ [<img src="docs/images/flights_by_delay.png?raw=true" width="500" />](docs/images/flights_by_delay.png?raw=true)
163
+
164
+ ##### Custom
165
+
166
+ You can define custom dimensions in your model. For example, if `Flight` has a column named `delay` (in minutes), we can define a `hours_delayed` dimension:
167
+
168
+ ```ruby
169
+ class Flight < ApplicationRecord
170
+ include ReportsKit::Model
171
+
172
+ reports_kit do
173
+ dimension :hours_delayed, group: 'GREATEST(ROUND(flights.delay::float/60), 0)'
174
+ end
175
+ end
176
+ ```
177
+
178
+ We can then use the `hours_delayed` dimension:
179
+
180
+ ```yaml
181
+ measure: flight
182
+ dimensions:
183
+ - hours_delayed
184
+ ```
185
+ [<img src="docs/images/flights_by_hours_delayed.png?raw=true" width="500" />](docs/images/flights_by_hours_delayed.png?raw=true)
186
+
187
+ #### Options
188
+
189
+ ##### `key` *String*
190
+
191
+ The dimension's identifier. You can use association names (e.g. `author`), column names (e.g. `created_at`), or the keys of custom dimensions (e.g. `my_dimension`).
192
+
193
+ ##### `limit` *Integer*
194
+
195
+ The maximum number of dimension instances to include.
196
+
197
+ ### Filters
198
+
199
+ #### Overview
200
+
201
+ A filter is like a `where`: it filters the results to only include results that match a condition. You can use datetime columns, integer columns, string columns, associations, or even define custom filters.
202
+
203
+ For example, if the `Flight` model has a `delay` column that's an integer, the chart below will show only flights that have a delay of greater than 15 minutes:
204
+
205
+ ```yaml
206
+ measure:
207
+ key: flight
208
+ filters:
209
+ - key: delay
210
+ criteria:
211
+ operator: '>'
212
+ value: 15
213
+ dimensions:
214
+ - carrier
215
+ ```
216
+ [<img src="docs/images/flights_with_configured_number.png?raw=true" width="500" />](docs/images/flights_with_configured_number.png?raw=true)
217
+
218
+ You can also create form controls that the user can use to filter the chart:
219
+
220
+ ```yaml
221
+ measure:
222
+ key: flight
223
+ filters:
224
+ - carrier
225
+ - carrier_name
226
+ - is_on_time
227
+ - flight_at
228
+ dimensions:
229
+ - flight_at
230
+ - carrier
231
+ ```
232
+
233
+ In `app/views/my_view.html.haml`:
234
+ ```haml
235
+ = render_report 'filters' do
236
+ .pull-right
237
+ = f.date_range :flight_at
238
+ = f.multi_autocomplete :carrier, scope: 'top', placeholder: 'Carrier...'
239
+ = f.string_filter :carrier_name, placeholder: 'Carrier name (e.g. Airlines)...', style: 'width: 175px;'
240
+ .checkbox
241
+ = label_tag :is_on_time do
242
+ = f.check_box :is_on_time
243
+ On time
244
+ ```
245
+ [<img src="docs/images/flights_with_filters.png?raw=true" width="500" />](docs/images/flights_with_filters.png?raw=true)
246
+
247
+ #### Types
248
+
249
+ ##### Boolean
250
+
251
+ ```yaml
252
+ measure:
253
+ key: flight
254
+ filters:
255
+ - key: is_on_time
256
+ criteria:
257
+ operator: true
258
+ value: 15
259
+ dimensions:
260
+ - carrier
261
+ ```
262
+ [<img src="docs/images/flights_with_configured_boolean.png?raw=true" width="500" />](docs/images/flights_with_configured_boolean.png?raw=true)
263
+
264
+ ##### Datetime
265
+
266
+ ```yaml
267
+ measure:
268
+ key: flight
269
+ filters:
270
+ - key: flight_at
271
+ criteria:
272
+ operator: between
273
+ value: Oct 1, 2016 - Jan 1, 2017
274
+ dimensions:
275
+ - carrier
276
+ ```
277
+ [<img src="docs/images/flights_with_configured_datetime.png?raw=true" width="500" />](docs/images/flights_with_configured_datetime.png?raw=true)
278
+
279
+ ##### Number
280
+
281
+ ```yaml
282
+ measure:
283
+ key: flight
284
+ filters:
285
+ - key: delay
286
+ criteria:
287
+ operator: '>'
288
+ value: 15
289
+ dimensions:
290
+ - carrier
291
+ ```
292
+ [<img src="docs/images/flights_with_configured_number.png?raw=true" width="500" />](docs/images/flights_with_configured_number.png?raw=true)
293
+
294
+ ##### String
295
+
296
+ ```yaml
297
+ measure:
298
+ key: flight
299
+ filters:
300
+ - key: carrier_name
301
+ criteria:
302
+ operator: contains
303
+ value: airlines
304
+ dimensions:
305
+ - carrier
306
+ ```
307
+ [<img src="docs/images/flights_with_configured_string.png?raw=true" width="500" />](docs/images/flights_with_configured_string.png?raw=true)
308
+
309
+
310
+ #### Form Controls
311
+
312
+ ##### Check Box
313
+
314
+ ```yaml
315
+ measure:
316
+ key: flight
317
+ filters:
318
+ - is_on_time
319
+ dimensions:
320
+ - flight_at
321
+ - carrier
322
+ ```
323
+ ```haml
324
+ = render_report 'filter_check_box' do
325
+ .checkbox
326
+ = label_tag :is_on_time do
327
+ = f.check_box :is_on_time
328
+ On time
329
+ ```
330
+ [<img src="docs/images/flights_with_check_box.png?raw=true" width="500" />](docs/images/flights_with_check_box.png?raw=true)
331
+
332
+ ##### Date Range
333
+
334
+ ```yaml
335
+ measure:
336
+ key: flight
337
+ filters:
338
+ - flight_at
339
+ dimensions:
340
+ - flight_at
341
+ - carrier
342
+ ```
343
+ ```haml
344
+ = render_report 'filter_date_range' do
345
+ = f.date_range :flight_at
346
+ ```
347
+ [<img src="docs/images/flights_with_date_range.png?raw=true" width="500" />](docs/images/flights_with_date_range.png?raw=true)
348
+
349
+ ##### Multi-Autocomplete
350
+
351
+ ```yaml
352
+ measure:
353
+ key: flight
354
+ filters:
355
+ - carrier
356
+ dimensions:
357
+ - flight_at
358
+ - carrier
359
+ ```
360
+ ```haml
361
+ = render_report 'filter_multi_autocomplete' do
362
+ = f.multi_autocomplete :carrier, scope: 'top', placeholder: 'Carrier...'
363
+ ```
364
+ [<img src="docs/images/flights_with_multi_autocomplete.png?raw=true" width="500" />](docs/images/flights_with_multi_autocomplete.png?raw=true)
365
+
366
+ ##### String Filter
367
+
368
+ ```yaml
369
+ measure:
370
+ key: flight
371
+ filters:
372
+ - carrier_name
373
+ dimensions:
374
+ - flight_at
375
+ - carrier
376
+ ```
377
+ ```haml
378
+ = render_report 'filter_string' do
379
+ = f.string_filter :carrier_name, placeholder: 'Carrier name (e.g. Airlines)...', style: 'width: 175px;'
380
+ ```
381
+ [<img src="docs/images/flights_with_string_filter.png?raw=true" width="500" />](docs/images/flights_with_string_filter.png?raw=true)
382
+
383
+ ### Display Options
384
+
385
+ #### Overview
386
+
387
+ Charts are rendered using [Chart.js](http://www.chartjs.org/). You can configure your ReportsKit chart using any [Chart.js options](http://www.chartjs.org/docs/).
388
+
389
+ ##### `type`
390
+
391
+ You can use any `type` value supported by Chart.js, including `bar`, `line`, `horizontalBar`, `radar`, and more.
392
+
393
+ Here's an example of a horizontal bar chart:
394
+
395
+ ```yaml
396
+ measure: flight
397
+ dimensions:
398
+ - carrier
399
+ chart:
400
+ type: horizontalBar
401
+ options:
402
+ scales:
403
+ xAxes:
404
+ - scaleLabel:
405
+ display: true
406
+ labelString: Flights
407
+ yAxes:
408
+ - scaleLabel:
409
+ display: true
410
+ labelString: Carrier
411
+ ```
412
+ [<img src="docs/images/horizontal_bar.png?raw=true" width="500" />](docs/images/horizontal_bar.png?raw=true)
413
+
414
+ ##### `options`
415
+
416
+ You can use any `options` that are supported by Chart.js.
417
+
418
+ Here's an example of a chart with Chart.js options:
419
+
420
+ ```yaml
421
+ measure: flight
422
+ dimensions:
423
+ - origin_market
424
+ - carrier
425
+ chart:
426
+ type: horizontalBar
427
+ options:
428
+ scales:
429
+ xAxes:
430
+ - stacked: true
431
+ scaleLabel:
432
+ display: true
433
+ labelString: Flights
434
+ yAxes:
435
+ - stacked: true
436
+ scaleLabel:
437
+ display: true
438
+ labelString: Market
439
+ ```
440
+ [<img src="docs/images/chart_options.png?raw=true" width="500" />](docs/images/chart_options.png?raw=true)
441
+
442
+ ##### `datasets`
443
+
444
+ You can use any `datasets` options that are supported by Chart.js.
445
+
446
+ Here's an example of a chart with `datasets` options:
447
+
448
+ ```yaml
449
+ measure: flight
450
+ dimensions:
451
+ - flight_at
452
+ - key: carrier
453
+ limit: 3
454
+ chart:
455
+ type: line
456
+ datasets:
457
+ fill: false
458
+ borderDash:
459
+ - 5
460
+ - 5
461
+ ```
462
+ [<img src="docs/images/dashed_line.png?raw=true" width="500" />](docs/images/dashed_line.png?raw=true)
463
+
464
+
465
+ License
466
+ -------
467
+
468
+ ReportsKit is released under the MIT License. Please see the MIT-LICENSE file for details.