Skip to content
Sergei Pond edited this page Jul 13, 2015 · 15 revisions

Functions which implement tree layout (mapping to screen coordinates), rendering, and element styling.

# phylotree.placenodes()

Run a tree layout algorithm for the current settings and tree state (e.g. collapsed/hidden clades), and populate the fields of node objects with screen coordinates and other rendering attributes. Returns phylotree. Note that this function does not refresh the rendering of the corresponding tree object on the screen (see update and refresh).

# phylotree.update([transitions])

Use current coordinates (from the last call to placenodes, or the constructor) styling and rendering settings to create appropriate SVG and JavaScript elements in the container object and the document, apply classes, and establish some event handlers (e.g. for the d3.svg.brush object to handle branch selection in interactive tree displays).

If transitions is supplied and is truthy, then d3.transitions will be used to animate the change from the previous to the new layout.

# phylotree.refresh()

Useful to redraw the tree object when changing CSS classes associated with its elements (nodes or edges), or if node or edge callback functions have been changed. This function does not recompute node placement, or modify the structure of the tree, it only affects the way existing SVG elements are rendered.

Clone this wiki locally