Class: ProductDecorator

Inherits:
GraphDecoration show all
Defined in:
lib/graph_decorator.rb

Overview

another concrete decorator

Instance Method Summary collapse

Methods inherited from GraphDecoration

#doubleChart, #multipleChart, #singleChart

Constructor Details

#initialize(real_graph) ⇒ ProductDecorator

Returns a new instance of ProductDecorator.



164
165
166
167
168
169
170
171
172
173
# File 'lib/graph_decorator.rb', line 164

def initialize(real_graph)
  super(real_graph)
  @y_name_1 = "Actual Price"
       @y_name_2 = "Offer Price"
       @y_data_1 = Product.select("price").group_by{|o| o.price}.keys
       @y_data_2 = Product.select("offerPrice").group_by{|o| o.offerPrice}.keys
       @x_name = Product.select("name").group_by{|o| o.name}.keys
       @y_data_3 = Product.select("quantityAvailable").group_by{|o| o.quantityAvailable}.keys
       @y_name_3 = "Quantity Available"
end