Method: Rubyvis::Layout::Partition#size
- Defined in:
- lib/rubyvis/layout/partition.rb
#size(f = nil, &block) ⇒ Object
Specifies the sizing function. By default, a sizing function is disabled and all nodes are given constant size. The sizing function is invoked for each leaf node in the tree (passed to the constructor).
<p>For example, if the tree data structure represents a file system, with files as leaf nodes, and each file has a bytes attribute, you can specify a size function as:
<pre> .size(function(d) d.bytes)</pre>
As with other properties, a size function may specify additional arguments to access the data associated with the layout and any enclosing panels.
119 120 121 122 123 124 |
# File 'lib/rubyvis/layout/partition.rb', line 119 def size(f=nil,&block) f=block if f.nil? raise "You should pass a proc" if f.nil? @_size=f self end |