This sample displays a bow-tie diagram of two trees sharing a single root node growing in opposite directions. The immediate child data of the ROOT node have a "dir" property that describes the direction that subtree should grow.

The Diagram.layout is an instance of the DoubleTreeLayout extension layout, defined in extensions/DoubleTreeLayout.js. The layout requires a DoubleTreeLayout.directionFunction predicate to decide for a child node of the root node which way the subtree should grow.


GoJS Features in this sample

Collections

GoJS provides its own collection classes: List, Set, and Map. You can iterate over a collection by using an Iterator. More information can be found in the GoJS Intro.

Related samples


Tree Layout

This predefined layout is used for placing Nodes of a tree-structured graph in layers (rows or columns). For discussion and examples of the most commonly used properties of the TreeLayout, see the Trees page in the Introduction. More information can be found in the GoJS Intro.

Related samples