Class: GoogleCharts::Charts::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/google_charts/charts/base.rb

Direct Known Subclasses

Line, Pie

Instance Method Summary collapse

Constructor Details

#initialize(template, collection, options = {}, html_options = {}) ⇒ Base

Returns a new instance of Base.



5
6
7
8
9
10
11
12
13
# File 'lib/google_charts/charts/base.rb', line 5

def initialize( template, collection, options = {}, html_options = {} )
  @template = template
  @collection = collection

  @options = options
  @html_options = { :id => "googleChart" }.merge( html_options )

  @columns, @rows = [], []
end

Instance Method Details

#title(val) ⇒ Object



15
# File 'lib/google_charts/charts/base.rb', line 15

def title( val ); @options[:title] = val; end

#to_htmlObject



17
18
19
20
21
22
23
24
25
# File 'lib/google_charts/charts/base.rb', line 17

def to_html
  setup_data

  [
    google_jsapi,
    container_div,
    google_chart
  ].join("\n")
end