Module: Chartify::WebChart::GoogleChart::GoogleChartModule

Included in:
BarChart, LineChart, PieChart
Defined in:
lib/chartify/web_chart/google_chart/google_chart_module.rb

Instance Method Summary collapse

Instance Method Details

#array_data_tableObject



23
24
25
26
27
28
# File 'lib/chartify/web_chart/google_chart/google_chart_module.rb', line 23

def array_data_table
  array_data = [[label_column] + column_names]
  array_data + data.collect do |row|
    [row[label_column]] + column_keys.collect { |col| row[col] }
  end
end

#chart_optionsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/chartify/web_chart/google_chart/google_chart_module.rb', line 7

def chart_options
  {
      title: title,
      backgroundColor: bg_color,
      colors: web_colors,
      vAxis: {baselineColor: baseline_color,
              gridlines: {color: grid_color},
              textStyle: {color: text_color}},
      hAxis: {baselineColor: baseline_color,
              gridlines: {color: grid_color},
              textStyle: {color: text_color}},
      legend: {textStyle: {color: text_color}},
      lineWidth: config.web_config.line_width
  }
end

#include_jsObject



30
31
32
33
# File 'lib/chartify/web_chart/google_chart/google_chart_module.rb', line 30

def include_js
  %q{<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization',
       'version':'1','packages':['timeline']}]}"></script>}
end