class Charts::ManikinCountChart

Public Instance Methods

arms(x, y, style) click to toggle source
# File lib/charts/count_chart/manikin_count_chart.rb, line 22
def arms(x, y, style)
  top    = y + height_percent(40)
  bottom = y + height_percent(70)
  left_x = x - width_percent(25)
  right_x = x + width_percent(25)

  renderer.line left_x, top, left_x, bottom, style.merge(class: 'left-arm')
  renderer.line right_x, top, right_x, bottom, style.merge(class: 'right-arm')
end
body(x, y, style) click to toggle source
# File lib/charts/count_chart/manikin_count_chart.rb, line 15
def body(x, y, style)
  top    = y + height_percent(40)
  bottom = y + height_percent(95)

  renderer.line x, top, x, bottom, style.merge(stroke_width: width_percent(30), class: 'body')
end
draw_item(x, y, color) click to toggle source
# File lib/charts/count_chart/manikin_count_chart.rb, line 2
def draw_item(x, y, color)
  head x + width_percent(50), y, style(color)
  body x + width_percent(50), y, style(color)
  arms x + width_percent(50), y, style(color)
end
head(x, y, style) click to toggle source
# File lib/charts/count_chart/manikin_count_chart.rb, line 8
def head(x, y, style)
  cy = y + height_percent(20)
  radius = height_percent(10)

  renderer.circle x, cy, radius, style.merge(class: 'head')
end
height_percent(multiplicator) click to toggle source
# File lib/charts/count_chart/manikin_count_chart.rb, line 44
def height_percent(multiplicator)
  multiplicator * item_height / 100
end
style(color) click to toggle source
# File lib/charts/count_chart/manikin_count_chart.rb, line 32
def style(color)
  {
    fill:         color,
    stroke:       color,
    stroke_width: width_percent(10)
  }
end
width_percent(multiplicator) click to toggle source
# File lib/charts/count_chart/manikin_count_chart.rb, line 40
def width_percent(multiplicator)
  multiplicator * item_width / 100
end