Class: Charts::SymbolCountChart

Inherits:
CountChart show all
Defined in:
lib/charts/count_chart/symbol_count_chart.rb

Instance Attribute Summary

Attributes inherited from Chart

#data, #options, #prepared_data, #renderer

Instance Method Summary collapse

Methods inherited from CountChart

#default_options, #draw, #draw_item, #draw_label_text, #draw_labels, #height, #label_count, #offset_x, #offset_y, #outer_item_height, #outer_item_width, #prepare_data, #validate_arguments, #width

Methods inherited from Chart

#create_options_methods, #default_options, #draw, #draw_background, #draw_title, #initialize, #initialize_instance_variables, #post_draw, #pre_draw, #prepare_data, #validate_arguments, #validate_array_and_count

Constructor Details

This class inherits a constructor from Charts::Chart

Instance Method Details

#renderObject



2
3
4
5
6
7
8
9
# File 'lib/charts/count_chart/symbol_count_chart.rb', line 2

def render
  render = prepared_data.map { |row| row.map(&:chr).join }.join("\n")
  if options[:filename]
    File.open(options[:filename], 'w') { |file| file.write(render) }
  else
    render
  end
end