Class: ActiveAnalytics::ViewsPerDay::Histogram::Bar

Inherits:
Object
  • Object
show all
Defined in:
app/models/active_analytics/views_per_day.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, value, histogram) ⇒ Bar

Returns a new instance of Bar.



66
67
68
# File 'app/models/active_analytics/views_per_day.rb', line 66

def initialize(label, value, histogram)
  @label, @value, @histogram = label, value, histogram
end

Instance Attribute Details

#histogramObject (readonly)

Returns the value of attribute histogram.



64
65
66
# File 'app/models/active_analytics/views_per_day.rb', line 64

def histogram
  @histogram
end

#labelObject (readonly)

Returns the value of attribute label.



64
65
66
# File 'app/models/active_analytics/views_per_day.rb', line 64

def label
  @label
end

#valueObject (readonly)

Returns the value of attribute value.



64
65
66
# File 'app/models/active_analytics/views_per_day.rb', line 64

def value
  @value
end

Instance Method Details

#heightObject



70
71
72
# File 'app/models/active_analytics/views_per_day.rb', line 70

def height
  (value.to_f / histogram.max_value).round(2)
end