Class: Charts::CrossCountChart

Inherits:
CountChart show all
Defined in:
lib/charts/count_chart/cross_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_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, #render, #validate_arguments, #validate_array_and_count

Constructor Details

This class inherits a constructor from Charts::Chart

Instance Method Details

#draw_item(x, y, color) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/charts/count_chart/cross_count_chart.rb', line 2

def draw_item(x, y, color)
  left   = x + 4
  right  = x + item_width - 4
  top    = y + 4
  bottom = y + item_height - 4

  style  = { stroke: color, stroke_width: 6, stroke_linecap: 'round' }

  renderer.line left, top, right, bottom, style
  renderer.line left, bottom, right, top, style
end