Class: Temper
- Inherits:
-
Object
- Object
- Temper
- Includes:
- Graphs::AreaNotStackedChart, Mongoid::Attributes::Dynamic, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/app/models/temper.rb
Class Method Summary collapse
- .axes_defaults ⇒ Object
- .chart_data(options = {}) ⇒ Object
- .graphs ⇒ Object
- .temper_chart(options) ⇒ Object
Class Method Details
.axes_defaults ⇒ Object
35 36 37 38 39 |
# File 'lib/app/models/temper.rb', line 35 def self.axes_defaults { :value_axis => {:title => 'Temperature in C'} } end |
.chart_data(options = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/app/models/temper.rb', line 9 def self.chart_data( = {}) charts = [] charts << self.temper_chart() return charts end |
.graphs ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/app/models/temper.rb', line 41 def self.graphs { :temperature => { :value_field => "Temperature", :hidden => false, :line_color => "#FF0000", :title => "Temperature" } } end |
.temper_chart(options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/app/models/temper.rb', line 15 def self.temper_chart() chart = self.chart_structure({:title => "Temperature in [C]", :value_axis => { :title => "Temperature"}}) # data = { # :value_axes => [ # { ## :stack_type => 'regular', # } # ], # } #TODO - get fields from above DRY chart[:graph_data] = Temper.where(:timestamp.gte => [:start]). where(:timestamp.lt => [:end]). where(:host_id => [:host_id]). where(:plugin_id => [:plugin_id]). order_by(timestamp: :asc) chart end |