Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MultiTreeViz

Generic visualization methods for trees

Hierarchy

Index

Constructors

constructor

  • new MultiTreeViz(width: number, height: number): MultiTreeViz

Properties

Private boxSize

boxSize: number

the size of the node spaces

containerDict

containerDict: default<NodeViz, NodeChildrenContainer>

Stores current node id along with the visualization structure of its children

edgeDict

edgeDict: default<string, EdgeViz>

Stores edges that are not regular (eg. have some highlight or label) by string source.id + "_" + target.id

id

id: string

dom id for <g> element

maxHeight

maxHeight: number

maxWidth

maxWidth: number

nodeRadius

nodeRadius: number

Radius of node in pixels

pseudo

pseudo: Pseudocode

root

root: NodeViz

Root NodeViz of the tree

timeline

timeline: any[]

Array of animation states through time

transitionDuration

transitionDuration: number

Methods

addChild

  • Adds a child node to a given parent node.

    Parameters

    Returns NodeViz

    the newly child node of type NodeViz

addRoot

  • Adds root node to current instance of MultiTreeViz.

    Returns NodeViz

    the newly created root node of type NodeViz

addSubtree

  • Adds tree of otherTree as the subtree of parent. Deletes otherTree

    Parameters

    Returns void

allNodes

getEdgeByNodes

  • Gets an EdgeViz object to manipulate an edge. If no object existed before it create a new one. Otherwise it returns the old one.

    Parameters

    Returns EdgeViz

    a new nodeViz object to manipulate the edge

Protected getElement

  • getElement(): Selection<any, any, any, any>
  • Returns the d3 selection that represents the structure. Probably a <g> element

    Returns Selection<any, any, any, any>

getNodeById

  • getNodeById(nId: string): NodeViz
  • ONLY MADE FOR TESTING PURPOSES. Returns node with id == nId`

    Parameters

    • nId: string

      the DOM id of the node

    Returns NodeViz

getParent

  • Returns the parent of node or null if node is the root.

    Parameters

    Returns NodeViz

getState

  • getState(): any
  • Returns a copy of the structures current state.

    Returns any

moveSubtree

  • Puts the subtree rooted at source in the location of target. Deleting the subtree of target.

    pre

    Precondition: target must not be a descendant of source.

    Parameters

    Returns void

pushAndTransition

  • pushAndTransition(): void
  • Pushes the current state onto the timeline and transitions to it.

    Returns void

pushState

  • pushState(): void
  • Adds the current state to the timeline.

    Returns void

removeNode

  • Removes node from the structure along with it's subtree.

    Parameters

    Returns void

setMaxHeight

  • setMaxHeight(n: number): void
  • Parameters

    • n: number

    Returns void

setMaxHeightWidth

  • setMaxHeightWidth(n: number): void

transition

  • transition(state: any): void
  • Smoothly transitions the structure to the given state

    Parameters

    • state: any

      the state to transition to. Should be one of the states in this.timeline

    Returns void

Private transitionLinks

  • transitionLinks(linkData: HierarchyLink<NodeChildrenContainer>[], trans: Transition<any, any, any, any>): void
  • Helper method for transition(). Transitions the links.

    Parameters

    • linkData: HierarchyLink<NodeChildrenContainer>[]

      data for the links based off state

    • trans: Transition<any, any, any, any>

      the D3 transition being used

    Returns void

Private transitionNodes

  • transitionNodes(nodeData: HierarchyNode<NodeChildrenContainer>[], trans: Transition<any, any, any, any>): void
  • Helper method for transition(). Transitions the nodes.

    Parameters

    • nodeData: HierarchyNode<NodeChildrenContainer>[]

      data for the nodes based off state

    • trans: Transition<any, any, any, any>

      the D3 transition being used

    Returns void

transplant

  • Swaps the position of 2 subtrees. If one node is a descendant of the other then the subtree of the ancestor will be removed and replaced with just the subtree of the descendant.

    Parameters

    Returns void

wipeOut

  • wipeOut(): void
  • Removes all nodes and edges from the tree including the root.

    Returns void

Generated using TypeDoc