Class: DSalesDecorator

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

Overview

a concrete decorator

Instance Method Summary collapse

Methods inherited from GraphDecoration

#doubleChart, #multipleChart, #singleChart

Constructor Details

#initialize(real_graph) ⇒ DSalesDecorator

Returns a new instance of DSalesDecorator.



45
46
47
48
49
50
51
52
53
54
# File 'lib/graph_decorator.rb', line 45

def initialize(real_graph)
  super(real_graph)
  @y_name_1 = "Total Sale"
     @y_name_2 = "Profit"
     @y_name_3 = "Non Offered Sale"
     @y_data_1 = Dsale.order('id desc').select("totalSale").group_by{|o| o.totalSale}.keys.take(7)
     @y_data_2 = Dsale.order('id desc').select("profit").group_by{|o| o.profit}.keys.take(7)
     @x_name = Dsale.order('id desc').select("day").group_by{|o| o.day}.keys.take(7)
     @y_data_3 = Dsale.order('id desc').select("nonOfferedSale").group_by{|o| o.nonOfferedSale}.keys.take(7)
end