# File lib/sparklines.rb, line 258
  def bar
    step             = @options[:step].to_f
    height           = @options[:height].to_f
    width            = ((@norm_data.size - 1) * step).to_f
    background_color = @options[:background_color]

    create_canvas(@norm_data.length * step + 2, height, background_color)

    upper            = @options[:upper].to_f
    below_color      = @options[:below_color]
    above_color      = @options[:above_color]

    target           = @options.has_key?(:target) ? @options[:target].to_f : nil
    target_color     = @options[:target_color] || 'white'

    i = 1
    # raise @norm_data.to_yaml
    max_normalized = @norm_data.max
    @norm_data.each_with_index do |r, index|
      color = (@data[index] >= upper) ? above_color : below_color
      @draw.stroke('transparent')
      @draw.fill(color)
      bar_height_from_top = @canvas.rows - ( (r.to_f / max_normalized.to_f) * @canvas.rows)
      @draw.rectangle( i, @canvas.rows, i + step - 2, bar_height_from_top )
      i += step
    end

    unless target.nil?
      normalized_target_value = ((target.to_f - @minimum_value)/(@maximum_value - @minimum_value)) * 100.0
      adjusted_target_value = (height - 3 - normalized_target_value/(101.0/(height-4))).to_i
      @draw.stroke(target_color)
      open_ended_polyline([[-5, adjusted_target_value], [width + 5, adjusted_target_value]])
    end

    @draw.draw(@canvas)
    @canvas
  end