Sha256: ea77003e6e3ef0919bdeb2e6caa2c3b011a9800af48a3aadc03880ff6b296535

Contents?: true

Size: 954 Bytes

Versions: 13

Compression:

Stored size: 954 Bytes

Contents

module Rubyvis
  module SvgScene
    def self.bar(scenes)
      e=scenes._g.elements[1]
      scenes.each_with_index do |s,i|
        next unless s.visible
        fill=s.fill_style
        stroke=s.stroke_style
        next if(fill.opacity==0.0 and stroke.opacity==0.0)
        e=SvgScene.expect(e,'rect', {
          "shape-rendering"=> s.antialias ? nil : "crispEdges",
          "pointer-events"=> s.events,
          "cursor"=> s.cursor,
          "x"=> s.left,
          "y"=> s.top,
          "width"=> [1E-10, s.width].max,
          "height"=> [1E-10, s.height].max,
          "fill"=> fill.color,
          "fill-opacity"=> (fill.opacity==0) ? nil : fill.opacity,
          "stroke"=> stroke.color,
          "stroke-opacity"=> (stroke.opacity==0) ? nil : stroke.opacity,
          "stroke-width"=> stroke.opacity ? s.line_width / SvgScene.scale.to_f : nil
        })

        e=SvgScene.append(e,scenes,i)

      end
      e
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rubyvis-0.3.3 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.3.2 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.3.1 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.3.0 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.2.2 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.2.1 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.2.0 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.1.7 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.1.6 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.1.5 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.1.4 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.1.3 lib/rubyvis/scene/svg_bar.rb
rubyvis-0.1.2 lib/rubyvis/scene/svg_bar.rb