Class: MSaleOfferDecorator
- Inherits:
-
GraphDecoration
- Object
- GraphDecoration
- MSaleOfferDecorator
- 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) ⇒ MSaleOfferDecorator
constructor
this functionality initialises with the data from the application models.
Methods inherited from GraphDecoration
#doubleChart, #multipleChart, #singleChart
Constructor Details
#initialize(real_graph) ⇒ MSaleOfferDecorator
this functionality initialises with the data from the application models
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/graph_decorator.rb', line 238 def initialize(real_graph) super(real_graph) @y_name_1 = "Offered Sale" @y_name_2 = "Non Offered Sale" @y_name_3 = "Non Offered Sale" @y_data_1 = [] @y_data_2 = [] @y_data_3 = [] @x_name = [] @y_data = Msale.all @y_data.each do |pro| @y_data_1 << pro.offeredSale @y_data_2 << pro.nonOfferedSale @y_data_3 << pro.nonOfferedSale @x_name << pro.month end #@y_data_1 = Msale.order('id desc').select("offeredSale").group_by{|o| o.offeredSale}.keys.take(7) #@y_data_2 = Msale.order('id desc').select("nonOfferedSale").group_by{|o| o.nonOfferedSale}.keys.take(7) #@x_name = Msale.order('id desc').select("month").group_by{|o| o.month}.keys.take(7) #@y_data_3 = Msale.order('id desc').select("nonOfferedSale").group_by{|o| o.nonOfferedSale}.keys.take(7) end |