Class: GChart::Meter
Instance Attribute Summary collapse
-
#label ⇒ Object
Returns the value of attribute label.
Attributes inherited from Base
#axes, #chart_background, #colors, #data, #entire_background, #extras, #height, #legend, #max, #title, #width
Instance Method Summary collapse
-
#render_chart_type ⇒ Object
:nodoc:.
-
#render_data(params) ⇒ Object
The data for a meter is a single data point expressed as a percent.
-
#render_legend(params) ⇒ Object
Commandeer render_legend to render the label.
Methods inherited from Base
#axis, #fetch, #initialize, #size, #size=, #to_url, #write
Constructor Details
This class inherits a constructor from GChart::Base
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/gchart/meter.rb', line 3 def label @label end |
Instance Method Details
#render_chart_type ⇒ Object
:nodoc:
5 6 7 |
# File 'lib/gchart/meter.rb', line 5 def render_chart_type #:nodoc: "gom" end |
#render_data(params) ⇒ Object
The data for a meter is a single data point expressed as a percent
10 11 12 13 |
# File 'lib/gchart/meter.rb', line 10 def render_data(params) value = data.is_a?(Array) ? data.flatten.first : data params["chd"] = "t:#{value.to_f}" end |
#render_legend(params) ⇒ Object
Commandeer render_legend to render the label
24 25 26 27 |
# File 'lib/gchart/meter.rb', line 24 def render_legend(params) self.label = legend if self.label.nil? # Can use legend instead of label params["chl"] = label if label end |