Class: ActiveAnalytics::ViewsPerDay::Histogram::Bar
- Inherits:
-
Object
- Object
- ActiveAnalytics::ViewsPerDay::Histogram::Bar
- Defined in:
- app/models/active_analytics/views_per_day.rb
Instance Attribute Summary collapse
-
#histogram ⇒ Object
readonly
Returns the value of attribute histogram.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #height ⇒ Object
-
#initialize(label, value, histogram) ⇒ Bar
constructor
A new instance of Bar.
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
#histogram ⇒ Object (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 |
#label ⇒ Object (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 |
#value ⇒ Object (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
#height ⇒ Object
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 |