documentationfor yFiles for HTML 3.0.0.3

ComponentLayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel>

Specifies custom data for the ComponentLayout.

Inheritance Hierarchy

Examples

The following example shows how to create a new instance of ComponentLayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> and use it with an ComponentLayout:

Creating an instance of ComponentLayoutData
const layoutData = new ComponentLayoutData()
// Only process components that contain a selected node
layoutData.affectedComponents = graphComponent.selection.nodes
// Reserve additional space around nodes
layoutData.nodeMargins = new Insets(15)

graphComponent.graph.applyLayout(new ComponentLayout(), layoutData)

In many cases the complete initialization of ComponentLayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> can also be done in a single object initializer:

Using an object initializer for easy creation of ComponentLayoutData
const layoutData = new ComponentLayoutData({
  // Only process components that contain a selected node
  affectedComponents: graphComponent.selection.nodes,
  // Reserve additional space around nodes
  nodeMargins: new Insets(15),
})

graphComponent.graph.applyLayout(new ComponentLayout(), layoutData)

Type Parameters

TNode
TEdge
TNodeLabel
TEdgeLabel

Type Details

yFiles module
algorithms

Constructors

Properties

Methods