Class: GoogleChart::BarChart

Inherits:
AbstractChart show all
Includes:
Axis, BarStyle, Color, Data, GridLine, Legend, RangeMarker, Title
Defined in:
lib/google_chart/bar_chart.rb

Constant Summary collapse

@@orientations =
{:horizontal => 'h', :vertical => 'v'}
@@groupings =
{:group => 'g', :stack => 's', :overlap => 's'}

Instance Attribute Summary collapse

Attributes included from Data

#scale

Attributes included from BarStyle

#width

Attributes inherited from AbstractChart

#size

Instance Method Summary collapse

Methods included from Title

included, #title, #title=

Methods included from RangeMarker

included, #ranges, #ranges=

Methods included from Legend

included, #legend, #legend=

Methods included from GridLine

#grid, #grid=, included

Methods included from Data

#data, #data=, included

Methods included from Color

#color, #color=, included

Methods included from BarStyle

included, #spacing=, #style

Methods included from Axis

#axes, #axes=, included

Methods inherited from AbstractChart

inherited, #initialize, register!, registered?, registry, #to_url

Constructor Details

This class inherits a constructor from GoogleChart::AbstractChart

Instance Attribute Details

#grouping=(value) ⇒ Object (writeonly)

Sets the attribute grouping

Parameters:

  • value

    the value to set the attribute grouping to.



17
18
19
# File 'lib/google_chart/bar_chart.rb', line 17

def grouping=(value)
  @grouping = value
end

#orientation=(value) ⇒ Object (writeonly)

Sets the attribute orientation

Parameters:

  • value

    the value to set the attribute orientation to.



17
18
19
# File 'lib/google_chart/bar_chart.rb', line 17

def orientation=(value)
  @orientation = value
end

Instance Method Details

#chart_typeObject



23
24
25
26
27
# File 'lib/google_chart/bar_chart.rb', line 23

def chart_type
  @grouping    ||= :group
  @orientation ||= :vertical
  "cht=b#{@@orientations[@orientation]}#{@@groupings[@grouping]}"
end

#horizontal=(arg) ⇒ Object



19
20
21
# File 'lib/google_chart/bar_chart.rb', line 19

def horizontal=(arg)
  self.orientation = arg ? :horizontal : :vertical
end