Class: Chartify::WebChart::GoogleChart::BarChart

Inherits:
BarChart show all
Includes:
GoogleChartModule
Defined in:
lib/chartify/web_chart/google_chart/bar_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 BarChart

#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/bar_chart.rb', line 10

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