Module: GoogleChart::GridLine

Included in:
BarChart, LineChart
Defined in:
lib/google_chart/grid_line.rb

Constant Summary collapse

@@grid_line_styles =
{ :solid => [1,0], :dash => [3,2], :dot => [1,2] }
@@default_grid_step =
0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
# File 'lib/google_chart/grid_line.rb', line 4

def self.included(klass)
  klass.register!(:grid)
end

Instance Method Details

#gridObject



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

def grid
  "chg=#{@grid}" if @grid
end

#grid=(grid) ⇒ Object



11
12
13
14
15
# File 'lib/google_chart/grid_line.rb', line 11

def grid=(grid)
  grid[:x] ||= @@default_grid_step
  grid[:y] ||= @@default_grid_step
  @grid = [grid[:x], grid[:y], *@@grid_line_styles[grid[:style]]].compact.join(',')
end