class Rubyvis::Layout::Indent

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 depth and 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.

Public Class Methods

defaults() click to toggle source

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
new() click to toggle source

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

Public Instance Methods

build_implied(s) click to toggle source
# 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[0], 1, 1)