class Rubyvis::Layout::Hierarchy

Represents an abstract layout for hierarchy diagrams. This class is a specialization of Rubyvis::Layout::Network, providing the basic structure for both hierarchical node-link diagrams (such as Reingold-Tilford trees) and space-filling hierarchy diagrams (such as sunbursts and treemaps).

<p>Unlike general network layouts, the links property need not be defined explicitly. Instead, the links are computed implicitly from the parent_node attribute of the node objects, as defined by the nodes property. This implementation is also available as +#links, for reuse with non-hierarchical layouts; for example, to render a tree using force-directed layout.

<p>Correspondingly, the nodes property is represented as a union of Rubyvis::Layout::Network::Node} and Rubyvis::Dom::Node. To construct a node hierarchy from a simple JSON map, use the Rubyvis::Dom operator; this operator also provides an easy way to sort nodes before passing them to the layout.

<p>For more details on how to use this layout, see Rubyvis::Layout::Network

@see Rubyvis::Layout::Cluster @see Rubyvis::Layout::Partition @see Rubyvis::Layout::Tree @see Rubyvis::Layout::Treemap @see Rubyvis::Layout::Indent @see Rubyvis::Layout::Pack

Public Class Methods

new() click to toggle source
# File lib/rubyvis/layout/hierarchy.rb, line 36
def initialize

Public Instance Methods

build_implied(s) click to toggle source
# File lib/rubyvis/layout/hierarchy.rb, line 40
def build_implied(s)
hierarchy_build_implied(s) click to toggle source

@private Compute the implied links. (Links are null by default.) */

# File lib/rubyvis/layout/hierarchy.rb, line 44
def hierarchy_build_implied(s)
  s.links=self.links() if !s.links