Class: PulseMeter::Visualize::Widgets::Timeline

Inherits:
PulseMeter::Visualize::Widget show all
Defined in:
lib/pulse-meter/visualize/widgets/timeline.rb

Direct Known Subclasses

Area, Line, Table

Defined Under Namespace

Classes: DifferentSensorIntervalsInWidget, NotATimelinedSensorInWidget

Constant Summary collapse

DEFAULT_TIMESPAN =
3600

Instance Method Summary collapse

Methods inherited from PulseMeter::Visualize::Widget

#type

Methods inherited from Base

#method_missing

Constructor Details

#initialize(opts) ⇒ Timeline

Returns a new instance of Timeline.



12
13
14
15
# File 'lib/pulse-meter/visualize/widgets/timeline.rb', line 12

def initialize(opts)
  super
  opts[:timespan] ||= DEFAULT_TIMESPAN
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PulseMeter::Visualize::Base

Instance Method Details

#data(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/pulse-meter/visualize/widgets/timeline.rb', line 17

def data(options = {})
  real_timespan = options[:timespan] || timespan
  super().merge({
    values_title: values_label,
    series: series_data(real_timespan),
    timespan: timespan
  })
end