Skip to main content

constructTree()

constructTree constructs a tree from a JSON object.

Learn more about the constructTree plugin.

graphUtils.constructTree(
parent: ConstructTreeNode | any,
config: ConstructTreeConfig
): dia.Cell[];

Construct a tree from a JSON object (parent, i.e. the top level node).

Types

ConstructTreeConfig

interface ConstructTreeConfig {
children?: string | ((node: ConstructTreeNode | any) => ConstructTreeNode[] | any);
makeElement: (node: ConstructTreeNode, parentElement: dia.Element | null) => dia.Element;
makeLink: (parentElement: dia.Element, childElement: dia.Element) => dia.Link;
}

ConstructTreeNode

interface ConstructTreeNode {
children?: ConstructTreeNode[];
[property: string]: any;
}

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub