Class: GChart::Bar
Constant Summary collapse
- ORIENTATIONS =
[:horizontal, :vertical]
Instance Attribute Summary collapse
-
#grouped ⇒ Object
(also: #grouped?)
Returns the value of attribute grouped.
-
#orientation ⇒ Object
Returns the value of attribute orientation.
-
#spacing ⇒ Object
Returns the value of attribute spacing.
-
#thickness ⇒ Object
Returns the value of attribute thickness.
Attributes inherited from Base
#axes, #chart_background, #colors, #data, #entire_background, #extras, #height, #legend, #max, #title, #width
Instance Method Summary collapse
- #horizontal? ⇒ Boolean
-
#initialize(*args, &block) ⇒ Bar
constructor
A new instance of Bar.
-
#query_params(params = {}) ⇒ Object
overrides GChart::Base#query_params.
-
#render_chart_type ⇒ Object
:nodoc:.
- #vertical? ⇒ Boolean
Methods inherited from Base
#axis, #fetch, #size, #size=, #to_url, #write
Constructor Details
#initialize(*args, &block) ⇒ Bar
Returns a new instance of Bar.
13 14 15 16 17 |
# File 'lib/gchart/bar.rb', line 13 def initialize(*args, &block) @grouped = false @orientation = :horizontal super end |
Instance Attribute Details
#grouped ⇒ Object Also known as: grouped?
Returns the value of attribute grouped.
5 6 7 |
# File 'lib/gchart/bar.rb', line 5 def grouped @grouped end |
#orientation ⇒ Object
Returns the value of attribute orientation.
8 9 10 |
# File 'lib/gchart/bar.rb', line 8 def orientation @orientation end |
#spacing ⇒ Object
Returns the value of attribute spacing.
11 12 13 |
# File 'lib/gchart/bar.rb', line 11 def spacing @spacing end |
#thickness ⇒ Object
Returns the value of attribute thickness.
10 11 12 |
# File 'lib/gchart/bar.rb', line 10 def thickness @thickness end |
Instance Method Details
#horizontal? ⇒ Boolean
28 29 30 |
# File 'lib/gchart/bar.rb', line 28 def horizontal? @orientation == :horizontal end |
#query_params(params = {}) ⇒ Object
overrides GChart::Base#query_params
47 48 49 50 51 52 53 54 |
# File 'lib/gchart/bar.rb', line 47 def query_params(params={}) #:nodoc: values = [] values << thickness if thickness values << spacing if thickness && spacing params["chbh"] = values.join(",") unless values.empty? super(params) end |
#render_chart_type ⇒ Object
:nodoc:
56 57 58 |
# File 'lib/gchart/bar.rb', line 56 def render_chart_type #:nodoc: "b#{@orientation.to_s[0..0]}#{grouped? ? "g" : "s"}" end |
#vertical? ⇒ Boolean
32 33 34 |
# File 'lib/gchart/bar.rb', line 32 def vertical? @orientation == :vertical end |