Our aim with PhyloCanvas is to provide a simple API for embedding trees within HTML pages. Newick or Nexus files can be visualised and parameters set to provide data overlays, tree shape, node labelling and size and
PhyloCanvas is utilised within http://Microreact.org and http://wgsa.net
As well as providing an organisational structure for the code, using the prototype means that the code for the functions isn't copied into memory for each instance of PhyloCanvas.
The rendering engine for PhyloCanvas is designed to minimise the amount of load that is placed on the client browser. As such the rendering events only fire when the user performs an action such as zooming or panning through the tree.
The rendering itself is split into 2 phases, a pre-render to perform all the calculations related to determining the postion and layout of the tree, leaving only the actual drawing of the tree at the correct positon (offset) and zoom level.
When a subtree of the main tree is redrawn from a branch or a branch is rotated the tree reset and then pre-render must be re-run.