Class: Bitcharts::DaysController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Bitcharts::DaysController
- Defined in:
- app/controllers/bitcharts/days_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#files, #load_charts, #load_paths, #loaded?
Instance Method Details
#show ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/bitcharts/days_controller.rb', line 7 def show instance_exec(&Bitcharts.) render json: { labels: date_ranges.map(&:begin).map(&:to_s), datasets: chart_scope_pairs.map do |chart_and_scope| chart = chart_and_scope.first if chart_and_scope.size == 1 { label: chart.label, data: values(chart) } else scope = chart_and_scope.second { label: chart.scoped_label(scope), data: scoped_values(chart, scope) } end end } end |