Implements a hierarchical layout using the indent algorithm. This layout implements a node-link diagram where the nodes are presented in preorder traversal, and nodes are indented based on their depth from the root. This technique is used ubiquitously by operating systems to represent file directories; although it requires much vertical space, indented trees allow efficient interactive exploration of trees to find a specific node. In addition they allow rapid scanning of node labels, and multivariate data such as file sizes can be displayed adjacent to the hierarchy.
<p>The indent layout can be configured using the
breadth properties, which control the increments in pixel
space for each indent and row in the layout. This layout does not support
multiple orientations; the root node is rendered in the top-left, while
breadth is a vertical offset from the top, and
depth is a horizontal offset from the left.
<p>For more details on how to use this layout, see Rubyvis::Layout::Hierarchy
The vertical offset between nodes; defaults to 15.
The horizontal offset between different levels of the tree; defaults to 15.
Default properties for indent layouts. By default the depth and breadth offsets are 15 pixels.
# File lib/rubyvis/layout/indent.rb, line 49 def self.defaults Rubyvis::Layout::Indent.new.mark_extend(Rubyvis::Layout::Hierarchy.defaults). depth(15). breadth(15) end
Constructs a new, empty indent layout. Layouts are not typically constructed directly; instead, they are added to an existing panel via Rubyvis::Mark#add
# File lib/rubyvis/layout/indent.rb, line 30 def initialize super @link.interpolate("step-after") end
# File lib/rubyvis/layout/indent.rb, line 69 def build_implied(s) return nil if hierarchy_build_implied(s) nodes = s.nodes @bspace = s.breadth @dspace = s.depth @ax = 0 @ay = 0 position(nodes, 1, 1) end