class Scruffy::Layers::Scatter
Scruffy::Layers::Line¶ ↑
- Author
-
Mat Schaffer
- Date
-
March 20th, 2007
Simple scatter graph
Public Instance Methods
draw(svg, coords, options={})
click to toggle source
Renders scatter graph.
# File lib/scruffy/layers/scatter.rb, line 11 def draw(svg, coords, options={}) svg.g(:class => 'shadow', :transform => "translate(#{relative(0.5)}, #{relative(0.5)})") { coords.each { |coord| svg.circle( :cx => coord.first, :cy => coord.last + relative(0.9), :r => relative(2), :style => "stroke-width: #{relative(2)}; stroke: black; opacity: 0.35;" ) } } coords.each { |coord| svg.circle( :cx => coord.first, :cy => coord.last, :r => relative(2), :style => "stroke-width: #{relative(2)}; stroke: #{color.to_s}; fill: #{color.to_s}" ) } end