def layout(legend_info_array, vertical = false)
      if vertical
        longest = 0
        legend_info_array.each {|elem|
          cur_length = relative(50) * elem[:title].length
          longest = longest < cur_length ? cur_length : longest
        }
        y_positions = []
         (0..legend_info_array.length - 1).each {|y|
          y_positions << y * @line_height
        }
        [longest, y_positions]
      else
        legend_info_array.inject([0, []]) do |enum, elem|
          enum[0] += (relative(50) * 2) if enum.first != 0      # Add spacer between elements
          enum[1] << enum.first                                 # Add location to points
          enum[0] += relative(50)                               # Add room for color box
          enum[0] += (relative(50) * elem[:title].length)       # Add room for text
          
          [enum.first, enum.last]
        end        
      end
    end
def layout(legend_info_array, vertical = false)
      if vertical
        longest = 0
        legend_info_array.each {|elem|
          cur_length = relative(50) * elem[:title].length
          longest = longest < cur_length ? cur_length : longest
        }
        y_positions = []
         (0..legend_info_array.length - 1).each {|y|
          y_positions << y * @line_height
        }
        [longest, y_positions]
      else
        legend_info_array.inject([0, []]) do |enum, elem|
          enum[0] += (relative(50) * 2) if enum.first != 0      # Add spacer between elements
          enum[1] << enum.first                                 # Add location to points
          enum[0] += relative(50)                               # Add room for color box
          enum[0] += (relative(50) * elem[:title].length)       # Add room for text
          
          [enum.first, enum.last]
        end        
      end
    end
relevant_legend_info
 Returns an array consisting of the total width needed by the legend
 information, as well as an array of @x-coords for each element. If
 vertical, then these are @y-coords, and @x is 0

 ie: [200, [0, 50, 100, 150]]