class Scruffy::Components::ValueMarkers

Attributes

markers[RW]

Public Instance Methods

draw(svg, bounds, options={}) click to toggle source
# File lib/scruffy/components/value_markers.rb, line 9
def draw(svg, bounds, options={})
  markers = (options[:markers] || self.markers) || 5
  
  each_marker(markers, options[:min_value], options[:max_value], bounds[:height], options, :value_formatter) do |label, y|

    svg.text( label, 
      :x => bounds[:width], 
      :y => (bounds[:height] - y), 
      'font-size' => options[:theme].marker_font_size || relative(8),
      'font-family' => options[:theme].font_family,
      :fill => ((options[:marker_color_override] || options[:theme].marker) || 'white').to_s,
      'text-anchor' => 'end')
  end
end