Sha256: be09adeb16e4dc5dd3e49ebac51f21d31ab342347aa7f5334003d1d4877d90ea
Contents?: true
Size: 956 Bytes
Versions: 11
Compression:
Stored size: 956 Bytes
Contents
class Plasticine::Builder::Column < Plasticine::Builder::Base def initialize(id, options={}) super @visual.merge! columns: [], nature: 'column', axis_x_format: :string, axis_y_format: :number, axis_y_tick_count: 10, quarter_start_month: 1 @columns = {} end def add_column(x, y, options={}) options.reverse_merge! tooltip: nil @columns[x] = [] if not @columns[x] @columns[x] << { tooltip: options[:tooltip], y: y } end def axis_x_format=(format) @visual[:axis_x_format] = format end def axis_y_format=(format) @visual[:axis_y_format] = format end def axis_y_tick_count=(tick_count) @visual[:axis_y_tick_count] = tick_count end def quarter_start_month=(month) @visual[:quarter_start_month] = month end def close_visual super @columns.each do |x, data| @visual[:columns] << { x_value: x, y_values: data.map{ |d| d[:y] }, tooltip: data[0][:tooltip] } end end end
Version data entries
11 entries across 11 versions & 1 rubygems