Class: Chartify::WebChart::GoogleChart::AreaChart

Inherits:
AreaChart show all
Includes:
GoogleChartModule
Defined in:
lib/chartify/web_chart/google_chart/area_chart.rb

Instance Attribute Summary

Attributes inherited from ChartBase

#columns, #data, #label_column, #title

Instance Method Summary collapse

Methods included from GoogleChartModule

#array_data_table, #chart_options, #include_js, #timestamp

Methods inherited from AreaChart

#to_blob

Methods inherited from ChartBase

#add_row, evaluate_js, #initialize, #render_chart

Constructor Details

This class inherits a constructor from Chartify::ChartBase

Instance Method Details

#render(html_dom_id) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/chartify/web_chart/google_chart/area_chart.rb', line 10

def render(html_dom_id)
  js = <<-JS
    google.load("visualization", "1", {packages:["corechart"], callback:drawChart#{timestamp}});
    function drawChart#{timestamp}() {
      var data = google.visualization.arrayToDataTable(#{array_data_table.to_json});
      var chart = new google.visualization.AreaChart(document.getElementById('#{html_dom_id}'));
      chart.draw(data, #{chart_options.to_json});
    }
  JS
  js.html_safe
end