Class: ActsAsDashboard::LineGraphWidget
- Defined in:
- lib/acts_as_dashboard/line_graph_widget.rb
Constant Summary collapse
- @@default_height =
'200px'
- @@default_width =
'400px'
- @@default_x_axis =
:numbers
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#line_colours ⇒ Object
Returns the value of attribute line_colours.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x_axis ⇒ Object
Returns the value of attribute x_axis.
Attributes inherited from Widget
#block, #name, #title, #type, #update_interval
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(options = {}) ⇒ LineGraphWidget
constructor
A new instance of LineGraphWidget.
-
#line_colors ⇒ Object
Allow American spelling of the word “colours”.
- #line_colour=(line_colour) ⇒ Object
Methods inherited from Widget
Constructor Details
#initialize(options = {}) ⇒ LineGraphWidget
Returns a new instance of LineGraphWidget.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/acts_as_dashboard/line_graph_widget.rb', line 12 def initialize( = {}) .delete :type # Allow American spelling of the word "colours". if [:line_colors] [:line_colours] = [:line_colors] .delete :line_colors end self.type = :line_graph self.height = [:height ] || @@default_height self.width = [:width ] || @@default_width self.x_axis = [:x_axis ] || @@default_x_axis self.line_colours = [:line_colours] if [:line_colours] super end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
7 8 9 |
# File 'lib/acts_as_dashboard/line_graph_widget.rb', line 7 def height @height end |
#line_colours ⇒ Object
Returns the value of attribute line_colours.
9 10 11 |
# File 'lib/acts_as_dashboard/line_graph_widget.rb', line 9 def line_colours @line_colours end |
#width ⇒ Object
Returns the value of attribute width.
8 9 10 |
# File 'lib/acts_as_dashboard/line_graph_widget.rb', line 8 def width @width end |
#x_axis ⇒ Object
Returns the value of attribute x_axis.
10 11 12 |
# File 'lib/acts_as_dashboard/line_graph_widget.rb', line 10 def x_axis @x_axis end |
Instance Method Details
#attributes ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/acts_as_dashboard/line_graph_widget.rb', line 65 def attributes super.merge({ :height => @height, :width => @width, :line_colours => @line_colours, :x_axis => @x_axis, }) end |
#line_colors ⇒ Object
Allow American spelling of the word “colours”.
61 62 63 |
# File 'lib/acts_as_dashboard/line_graph_widget.rb', line 61 def line_colors line_colours end |
#line_colour=(line_colour) ⇒ Object
40 41 42 43 44 |
# File 'lib/acts_as_dashboard/line_graph_widget.rb', line 40 def line_colour=(line_colour) raise ArgumentError, 'The "line_colour" argument must be a String.' unless line_colour.is_a? String self.line_colours = [line_colour] end |