Methods

Class/Module Index [+]

Quicksearch

Scruffy::Components::DataMarkers

Public Instance Methods

draw(svg, bounds, options={}) click to toggle source
# File lib/scruffy/components/data_markers.rb, line 6
def draw(svg, bounds, options={})
  unless options[:point_markers].nil?
    point_distance = bounds[:width] / (options[:point_markers].size - 1).to_f
    
    (0...options[:point_markers].size).map do |idx| 
      x_coord = point_distance * idx
      svg.text(options[:point_markers][idx],
        :x => x_coord,
        :y => bounds[:height], 
        'font-size' => relative(90),
        'font-family' => options[:theme].font_family,
        :fill => (options[:theme].marker || 'white').to_s, 
        'text-anchor' => 'middle') unless options[:point_markers][idx].nil?
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.