Module: Rubyvis::AreaPrototype

Included in:
Area, Line, LinePrototype
Defined in:
lib/rubyvis/mark/area.rb

Overview

Provides methods pertinents to area like-marks.

Instance Method Summary collapse

Instance Method Details

#area_anchor(name) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/rubyvis/mark/area.rb', line 90

def area_anchor(name)
  #scene=nil
  anchor=mark_anchor(name)
  anchor.interpolate(lambda {
    self.scene.target[self.index].interpolate
  }).eccentricity(lambda {
    self.scene.target[self.index].eccentricity
  }).tension(lambda {
    self.scene.target[self.index].tension
  })
  anchor
end

#area_bindObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/rubyvis/mark/area.rb', line 68

def area_bind
  mark_bind
  
  binds = self.binds
  required = binds.required
  optional = binds.optional
  
  optional.size.times {|i|
    prop = optional[i]
    prop.fixed = fixed.keys.include? prop.name
    
    if (prop.name == "segmented")
      required.push(prop)
    end
  }
  optional.delete_if {|v| v.name=='segmented'}
  # Cache the original arrays so they can be restored on build. */
  @binds._required = required
  @binds._optional = optional
end

#area_build_instance(s) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/rubyvis/mark/area.rb', line 19

def area_build_instance(s)
  binds = self.binds
  # Handle fixed properties on secondary instances. */
  if (self.index!=0)
    fixed = @binds.fixed
    #/* Determine which properties are fixed. */
    if (!fixed)
      binds.fixed=[]
      fixed = binds.fixed
      filter=lambda {|prop|
        if prop.fixed
          fixed.push(prop)
          false
        else
          true
        end
      }
      #      p binds.required
      binds.required = binds.required.find_all(&filter)
      #      p binds.required
      if (!self.scene[0].segmented)
        binds.optional = binds.optional.find_all(&filter)
      end
      
    end
    
    #    p binds.required


    #/* Copy fixed property values from the first instance. */
    fixed.each {|prop|
      name=prop.name
      s[name]=self.scene[0][name]
    }
    
    
    #    p binds.fixed
    #/* Evaluate all properties on the first instance. */
  else
    binds.required = binds._required
    binds.optional = binds._optional
    binds.fixed = nil
  end
  # pp binds
  mark_build_instance(s)
end

#fixedObject

:nodoc:



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rubyvis/mark/area.rb', line 8

def fixed
  {
    :line_width=> true,
    :line_join=> true,
    :stroke_style=> true,
    :fill_style=> true,
    :segmented=> true,
    :interpolate=> true,
    :tension=> true
  }
end