def draw
@colors.reverse!
draw_title
@margin = 30.0
@thickness = @raw_rows / 6.0
@right_margin = @margin
@graph_left = @title_width * 1.3 rescue @margin
@graph_width = @raw_columns - @graph_left - @right_margin
@graph_height = @thickness * 3.0
@d = @d.fill @colors[0]
@d = @d.rectangle(@graph_left, 0, @graph_left + @graph_width, @graph_height)
[:high, :low].each_with_index do |indicator, index|
next unless @options.has_key?(indicator)
@d = @d.fill @colors[index + 1]
indicator_width_x = @graph_left + @graph_width * (@options[indicator] / @maximum_value)
@d = @d.rectangle(@graph_left, 0, indicator_width_x, @graph_height)
end
if @options.has_key?(:target)
@d = @d.fill @font_color
target_x = @graph_left + @graph_width * (@options[:target] / @maximum_value)
half_thickness = @thickness / 2.0
@d = @d.rectangle(target_x, half_thickness, target_x + half_thickness, @thickness * 2 + half_thickness)
end
@d = @d.fill @font_color
@d = @d.rectangle(@graph_left, @thickness, @graph_left + @graph_width * (@value / @maximum_value), @thickness * 2)
@d.draw(@base_image)
end