Class: ActiveAnalytics::Histogram::Bar
- Inherits:
-
Object
- Object
- ActiveAnalytics::Histogram::Bar
- Defined in:
- app/lib/active_analytics/histogram.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.
34 35 36 |
# File 'app/lib/active_analytics/histogram.rb', line 34 def initialize(label, value, histogram) @label, @value, @histogram = label, value, histogram end |
Instance Attribute Details
#histogram ⇒ Object (readonly)
Returns the value of attribute histogram.
32 33 34 |
# File 'app/lib/active_analytics/histogram.rb', line 32 def histogram @histogram end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
32 33 34 |
# File 'app/lib/active_analytics/histogram.rb', line 32 def label @label end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
32 33 34 |
# File 'app/lib/active_analytics/histogram.rb', line 32 def value @value end |
Instance Method Details
#height ⇒ Object
38 39 40 41 42 43 44 |
# File 'app/lib/active_analytics/histogram.rb', line 38 def height if histogram.max_value > 0 (value.to_f / histogram.max_value).round(2) else 0 end end |