Class: DataSet::HourlyDataSet
- Defined in:
- lib/data_set/hourly_data_set.rb
Instance Attribute Summary
Attributes inherited from DataSet
#count, #datapoints, #max_date, #max_value, #min_date, #min_value
Instance Method Summary collapse
-
#dates ⇒ Object
Array of dates corresponding to datapoints in “2009-11-18” format.
-
#initialize(point_array, count = 24) ⇒ HourlyDataSet
constructor
A new instance of HourlyDataSet.
Methods inherited from DataSet
#value_for_date, #values, #values_for_google_chart
Constructor Details
#initialize(point_array, count = 24) ⇒ HourlyDataSet
Returns a new instance of HourlyDataSet.
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/data_set/hourly_data_set.rb', line 3 def initialize( point_array, count = 24 ) @datapoints ||= {} #[["2008-06-01 12", 200.58], ["2008-06-02 13", 205.39]] @count = count point_array.each do |date, value| value = value.to_f @datapoints[date.to_s] = value end fill_with_zeroes(@count) trim_to_limit end |
Instance Method Details
#dates ⇒ Object
Array of dates corresponding to datapoints in “2009-11-18” format
18 19 20 |
# File 'lib/data_set/hourly_data_set.rb', line 18 def dates @datapoints.collect{|point| point[0]} end |