# File lib/gruff/side_bar.rb, line 21
  def draw_bars
    # Setup spacing.
    #
    @bar_spacing ||= 0.9

    @bars_width = @graph_height / @column_count.to_f
    @bar_width = @bars_width / @norm_data.size
    @d = @d.stroke_opacity 0.0
    height = Array.new(@column_count, 0)
    length = Array.new(@column_count, @graph_left)
    padding = (@bar_width * (1 - @bar_spacing)) / 2

    # if we're a side stacked bar then we don't need to draw ourself at all
    # because sometimes (due to different heights/min/max) you can actually
    # see both graphs and it looks like crap
    return if self.is_a?(Gruff::SideStackedBar)

    @norm_data.each_with_index do |data_row, row_index|
      @d = @d.fill data_row[DATA_COLOR_INDEX]

      data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index|

        # Using the original calcs from the stacked bar chart
        # to get the difference between
        # part of the bart chart we wish to stack.
        temp1 = @graph_left + (@graph_width - data_point * @graph_width - height[point_index])
        temp2 = @graph_left + @graph_width - height[point_index]
        difference = temp2 - temp1

        left_x = length[point_index] - 1
        left_y = @graph_top + (@bars_width * point_index) + (@bar_width * row_index) + padding
        right_x = left_x + difference
        right_y = left_y + @bar_width * @bar_spacing

        height[point_index] += (data_point * @graph_width)

        @d = @d.rectangle(left_x, left_y, right_x, right_y)

        # Calculate center based on bar_width and current row

        if @use_data_label
          label_center = @graph_top + (@bar_width * (row_index+point_index) + @bar_width / 2)
          draw_label(label_center, row_index, @norm_data[row_index][DATA_LABEL_INDEX])
        else
          label_center = @graph_top + (@bars_width * point_index + @bars_width / 2)
          draw_label(label_center, point_index)
        end
        if @show_labels_for_bar_values
          val = (@label_formatting || '%.2f') % @norm_data[row_index][3][point_index]
          draw_value_label(right_x+40, (@graph_top + (((row_index+point_index+1) * @bar_width) - (@bar_width / 2)))-12, val.commify, true)
        end
      end

    end

    @d.draw(@base_image)
  end