Class: WSalesDecorator
- Inherits:
-
GraphDecoration
- Object
- GraphDecoration
- WSalesDecorator
- Defined in:
- lib/graph_decorator.rb
Overview
a concrete decorator provides the data for the super class decorator according to the requirement of single colum or double column or triple column.
Instance Method Summary collapse
-
#initialize(real_graph) ⇒ WSalesDecorator
constructor
this functionality initialises with the data from the application models.
Methods inherited from GraphDecoration
#doubleChart, #multipleChart, #singleChart
Constructor Details
#initialize(real_graph) ⇒ WSalesDecorator
this functionality initialises with the data from the application models
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/graph_decorator.rb', line 100 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 = Wsale.order('id desc').select("totalSale").group_by{|o| o.totalSale}.keys.take(7) @y_data_2 = Wsale.order('id desc').select("profit").group_by{|o| o.profit}.keys.take(7) @x_name = Wsale.order('id desc').select("week").group_by{|o| o.week}.keys.take(7) @y_data_3 = Wsale.order('id desc').select("nonOfferedSale").group_by{|o| o.nonOfferedSale}.keys.take(7) end |