Class: ProductByHitDecorator
- Inherits:
-
GraphDecoration
- Object
- GraphDecoration
- ProductByHitDecorator
- 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) ⇒ ProductByHitDecorator
constructor
this functionality initialises with the data from the application models.
Methods inherited from GraphDecoration
#doubleChart, #multipleChart, #singleChart
Constructor Details
#initialize(real_graph) ⇒ ProductByHitDecorator
this functionality initialises with the data from the application models
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/graph_decorator.rb', line 317 def initialize(real_graph) super(real_graph) @y_name_1 = "No. of sales" @y_name_2 = "Hit" @y_data_1 = [] @y_data_2 = [] @y_data_3 = [] @x_name = [] @y_data = Product.all @y_data.each do |pro| @y_data_1 << pro.count @y_data_2 << pro.hit @y_data_3 << pro.quantityAvailable @x_name << pro.name end #@y_data_1 = Product.select("count").group_by{|o| o.count}.keys #@y_data_2 = Product.select("hit").group_by{|o| o.hit}.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 |