Class: Chartify::PieChart
- Defined in:
- lib/chartify/pie_chart.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from ChartBase
#columns, #data, #label_column, #title
Instance Method Summary collapse
-
#initialize ⇒ PieChart
constructor
A new instance of PieChart.
- #to_blob ⇒ Object
Methods inherited from ChartBase
#add_row, evaluate_js, #render_chart
Constructor Details
#initialize ⇒ PieChart
Returns a new instance of PieChart.
13 14 15 16 |
# File 'lib/chartify/pie_chart.rb', line 13 def initialize super self.columns = ['Title', 'Value'] end |
Instance Method Details
#to_blob ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/chartify/pie_chart.rb', line 18 def to_blob g = instantiate_gruff(:pie) data.each do |row| if row.kind_of?(Array) key, val = row[0], row[1] else key, val = row.key, row.val end g.data(key, val) end g.to_blob end |