Class: QueryReport::ChartAdapterModule::ChartAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/query_report/chart_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#chartObject

Returns the value of attribute chart.



16
17
18
# File 'lib/query_report/chart_adapter.rb', line 16

def chart
  @chart
end

#chart_typeObject

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

#queryObject

Returns the value of attribute query.



16
17
18
# File 'lib/query_report/chart_adapter.rb', line 16

def query
  @query
end