Class: Scruffy::Components::YLegend

Inherits:
Base
  • Object
show all
Defined in:
lib/scruffy/components/legend.rb

Instance Attribute Summary

Attributes inherited from Base

#id, #options, #position, #size, #visible

Instance Method Summary collapse

Methods inherited from Base

#initialize, #process, #render

Constructor Details

This class inherits a constructor from Scruffy::Components::Base

Instance Method Details

#draw(svg, bounds, options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/scruffy/components/legend.rb', line 22

def draw(svg, bounds, options={})
  if options[:title]
    svg.text(options[:y_legend],
             :class => 'title',
    :x => (0),
    :y => 0, 
        'font-size' => options[:theme].legend_font_size || relative(100),
        'font-family' => options[:theme].font_family,
        :transform => "translate(#{bounds[:width] / 2},#{bounds[:height]/2}) rotate(#{-90})",
    :fill => options[:theme].marker,
    :stroke => 'none', 'stroke-width' => '0',
        'text-anchor' => (@options[:text_anchor] || 'middle'))
  end
end