class BarChart::Bar

Attributes

bar_nr_in_set[R]
chart[R]
data_value[R]
set_nr[R]

Public Class Methods

new(chart, data_value, set_nr, bar_nr_in_set) click to toggle source
# File lib/charts/bar_chart/bar/bar.rb, line 4
def initialize(chart, data_value, set_nr, bar_nr_in_set)
  @chart = chart
  @data_value = data_value
  @set_nr = set_nr
  @bar_nr_in_set = bar_nr_in_set
end

Public Instance Methods

bar_number_in_chart() click to toggle source
# File lib/charts/bar_chart/bar/bar.rb, line 31
def bar_number_in_chart
  set_nr + bar_nr_in_set * chart.set_count
end
draw() click to toggle source
# File lib/charts/bar_chart/bar/bar.rb, line 11
def draw
  chart.renderer.rect x, y, width, height, fill: chart.colors[set_nr], class: 'bar'
end
height() click to toggle source
# File lib/charts/bar_chart/bar/bar.rb, line 27
def height
  raise NotImplementedError
end
width() click to toggle source
# File lib/charts/bar_chart/bar/bar.rb, line 23
def width
  raise NotImplementedError
end
x() click to toggle source
# File lib/charts/bar_chart/bar/bar.rb, line 15
def x
  raise NotImplementedError
end
y() click to toggle source
# File lib/charts/bar_chart/bar/bar.rb, line 19
def y
  raise NotImplementedError
end