Module: GoogleVisualr::Rails::ViewHelper

Extended by:
ActiveSupport::Concern
Defined in:
lib/google_visualr/app/helpers/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_chart(chart, dom, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/google_visualr/app/helpers/view_helper.rb', line 10

def render_chart(chart, dom, options={})
  script_tag = options.fetch(:script_tag) { true }
  if script_tag
    chart.to_js(dom).html_safe
  else
    html = ""
    html << chart.load_js(dom)
    html << chart.draw_js(dom)
    html.html_safe
  end
end