Class: SAAL::Chart
- Inherits:
-
Object
- Object
- SAAL::Chart
- Defined in:
- lib/chart.rb
Instance Attribute Summary collapse
-
#alignlabels ⇒ Object
readonly
Returns the value of attribute alignlabels.
-
#alt ⇒ Object
readonly
Returns the value of attribute alt.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#num ⇒ Object
readonly
Returns the value of attribute num.
-
#periods ⇒ Object
readonly
Returns the value of attribute periods.
-
#sensors ⇒ Object
readonly
Returns the value of attribute sensors.
Instance Method Summary collapse
- #average(num = nil) ⇒ Object
- #from ⇒ Object
-
#initialize(name, defs, sensors, opts = {}) ⇒ Chart
constructor
A new instance of Chart.
- #maximum(num = nil) ⇒ Object
- #minimum(num = nil) ⇒ Object
- #periodnames ⇒ Object
- #to ⇒ Object
Constructor Details
#initialize(name, defs, sensors, opts = {}) ⇒ Chart
Returns a new instance of Chart.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/chart.rb', line 4 def initialize(name, defs, sensors, opts={}) @name = name @defs = defs @alignlabels = (defs['alignlabels'] || :center).to_sym @sensors = defs['sensors'].map{|name| sensors.send(name)} @num = defs['last'] @periods = defs['periods'] @alt = defs['alt'] @description = defs['description'] @datarange = ChartDataRange.new(defs.merge(:now => opts[:now])) end |
Instance Attribute Details
#alignlabels ⇒ Object (readonly)
Returns the value of attribute alignlabels.
3 4 5 |
# File 'lib/chart.rb', line 3 def alignlabels @alignlabels end |
#alt ⇒ Object (readonly)
Returns the value of attribute alt.
3 4 5 |
# File 'lib/chart.rb', line 3 def alt @alt end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/chart.rb', line 3 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/chart.rb', line 3 def name @name end |
#num ⇒ Object (readonly)
Returns the value of attribute num.
3 4 5 |
# File 'lib/chart.rb', line 3 def num @num end |
#periods ⇒ Object (readonly)
Returns the value of attribute periods.
3 4 5 |
# File 'lib/chart.rb', line 3 def periods @periods end |
#sensors ⇒ Object (readonly)
Returns the value of attribute sensors.
3 4 5 |
# File 'lib/chart.rb', line 3 def sensors @sensors end |
Instance Method Details
#average(num = nil) ⇒ Object
20 21 22 |
# File 'lib/chart.rb', line 20 def average(num=nil) get_data(:average, num) end |
#from ⇒ Object
32 33 34 |
# File 'lib/chart.rb', line 32 def from @datarange.from end |
#maximum(num = nil) ⇒ Object
28 29 30 |
# File 'lib/chart.rb', line 28 def maximum(num=nil) get_data(:maximum, num) end |
#minimum(num = nil) ⇒ Object
24 25 26 |
# File 'lib/chart.rb', line 24 def minimum(num=nil) get_data(:minimum, num) end |
#periodnames ⇒ Object
16 17 18 |
# File 'lib/chart.rb', line 16 def periodnames @datarange.periodnames end |
#to ⇒ Object
35 36 37 |
# File 'lib/chart.rb', line 35 def to @datarange.to end |