Class: QueryReport::ChartAdapterModule::ChartAdapter
- Inherits:
-
Object
- Object
- QueryReport::ChartAdapterModule::ChartAdapter
- Defined in:
- lib/query_report/chart_adapter.rb
Instance Attribute Summary collapse
-
#chart ⇒ Object
Returns the value of attribute chart.
-
#chart_type ⇒ Object
Returns the value of attribute chart_type.
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(query, chart_type, chart_title) ⇒ ChartAdapter
constructor
A new instance of ChartAdapter.
Constructor Details
#initialize(query, chart_type, chart_title) ⇒ ChartAdapter
Returns a new instance of ChartAdapter.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/query_report/chart_adapter.rb', line 19 def initialize(query, chart_type, chart_title) @query = query @chart_type = chart_type @chart = "Chartify::#{chart_type.to_s.camelize}Chart".constantize.new @chart.title = chart_title # do |chart| # chart.data = [{hours_remain: 100, estimated_hours_remain: 100, day: 3.days.ago.to_date}, # {hours_remain: 50, estimated_hours_remain: 45, day: 2.days.ago.to_date}, # {hours_remain: 5, estimated_hours_remain: 10, day: 1.days.ago.to_date}] # chart.columns = {hours_remain: 'Hours remaining', estimated_hours_remain: 'Estimated hours remaining'} # chart.label_column = :day # end end |
Instance Attribute Details
#chart ⇒ Object
Returns the value of attribute chart.
16 17 18 |
# File 'lib/query_report/chart_adapter.rb', line 16 def chart @chart end |
#chart_type ⇒ Object
Returns the value of attribute chart_type.
16 17 18 |
# File 'lib/query_report/chart_adapter.rb', line 16 def chart_type @chart_type end |
#query ⇒ Object
Returns the value of attribute query.
16 17 18 |
# File 'lib/query_report/chart_adapter.rb', line 16 def query @query end |