Class: QueryReport::Chart::PieChart
- Defined in:
- lib/query_report/chart/pie_chart.rb
Instance Attribute Summary
Attributes inherited from ChartBase
#columns, #data, #options, #title
Instance Method Summary collapse
-
#initialize(title, query, options = {}) ⇒ PieChart
constructor
A new instance of PieChart.
- #prepare_visualr ⇒ Object
- #to_blob ⇒ Object
Methods inherited from ChartBase
Constructor Details
#initialize(title, query, options = {}) ⇒ PieChart
Returns a new instance of PieChart.
16 17 18 |
# File 'lib/query_report/chart/pie_chart.rb', line 16 def initialize(title, query, ={}) super(title, query, ) end |
Instance Method Details
#prepare_visualr ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/query_report/chart/pie_chart.rb', line 20 def prepare_visualr @data_table = GoogleVisualr::DataTable.new ##### Adding column header ##### @data_table.new_column('string', 'Item') @data_table.new_column('number', 'Value') ##### Adding column header ##### @columns.each_with_index do |column, i| @data_table.add_row([column.title, @data[i]]) end = {:title => title, backgroundColor: 'transparent'}.merge(@options) GoogleVisualr::Interactive::PieChart.new(@data_table, ) end |
#to_blob ⇒ Object
36 37 38 |
# File 'lib/query_report/chart/pie_chart.rb', line 36 def to_blob super(:pie) end |