Sha256: ea280363d53b2d4b5351971535467c1a91ea49e79d4935811640af388c7305f5

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

module Rubyvis
  # Alias for Rubyvis::Line
  def self.Line
    Rubyvis::Line
  end
  module LinePrototype 
    include AreaPrototype
    def line_anchor(name)
      anchor=area_anchor(name).text_align(lambda {|d|
          {'left'=>'right','bottom'=>'center', 'top'=>'center','center'=>'center','right'=>'left'}[self.name]
      }).text_baseline(lambda{|d|
        {'top'=>'bottom', 'right'=>'middle', 'left'=>'middle','center'=>'middle','bottom'=>'top'}[self.name]
      })
      return anchor
    end
  end
  class Line < Mark
    include AreaPrototype
    include LinePrototype
    @properties=Mark.properties.dup
    attr_accessor_dsl :line_width, :line_join, [:stroke_style, lambda {|d| Rubyvis.color(d)}], [:fill_style, lambda {|d| Rubyvis.color(d)}], :segmented, :interpolate, :eccentricity, :tension
    def type
      "line"
    end
    def anchor(name)
      line_anchor(name)
    end
    def bind(*args)
      area_bind(*args)
    end
    def build_instance(*args)
      area_build_instance(*args)
    end
    def self.defaults
      a=Rubyvis::Colors.category10()
      Line.new.extend(Mark.defaults).line_join('miter').line_width(1.5).stroke_style( lambda {return a.scale(self.parent.index)}).interpolate('linear').eccentricity(0).tension(7)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubyvis-0.1.7 lib/rubyvis/mark/line.rb
rubyvis-0.1.6 lib/rubyvis/mark/line.rb