# File lib/scruffy/components/legend.rb, line 4
    def draw(svg, bounds, options={})
      legend_info = relevant_legend_info(options[:layers])
      active_width, points = layout(legend_info)

      offset = (bounds[:width] - active_width) / 2    # Nudge over a bit for true centering

      # Render Legend
      points.each_with_index do |point, idx|
        
        svg.rect( :x => offset + point, 
                  :y => relative(25), 
                  :width => relative(60), 
                  :height => relative(50),
                  :fill => legend_info[idx][:color])
                  
       svg.text(  legend_info[idx][:title], 
                  :x => offset + point + relative(100), 
                  :y => relative(80), 
                  'font-size' => relative(80), 
                  :fill => (options[:theme].marker || 'white'))
      end
    end