Class: Chartify::LineChart
- Defined in:
- lib/chartify/line_chart.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from ChartBase
#columns, #data, #label_column, #title
Instance Method Summary collapse
Methods inherited from ChartBase
#add_row, evaluate_js, #initialize, #render_chart
Constructor Details
This class inherits a constructor from Chartify::ChartBase
Instance Method Details
#to_blob ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/chartify/line_chart.rb', line 16 def to_blob raise 'Need to specify label_column' unless label_column.present? g = prepare_gruff(:line) columns.each do |column| if column.kind_of?(Array) key, text = column[0], column[1] else key, text = column, column.to_s.humanize end g.data(text, data_for_column(key)) end labels = {} data_for_column(label_column).each_with_index do |label, index| labels[index] = label.to_s end g.labels = labels g.to_blob end |