documentationfor yFiles for HTML 3.0.0.3

GenericLayoutGridStageData<TNode,TEdge,TNodeLabel,TEdgeLabel>

Specifies the layout data for the GenericLayoutGridStage.

Inheritance Hierarchy

Examples

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

Creating an instance of GenericLayoutGridStageData
const layoutData = new GenericLayoutGridStageData()

// Define layout grid from custom data
layoutData.layoutGridData.rowIndices = (node) => node.tag.rowIndex
layoutData.layoutGridData.columnIndices = (node) => node.tag.columnIndex

// Define split edges from custom data
layoutData.splitEdges = (edge) => edge.tag.isSplitEdge

// Combine the layout data of the stage and the core layout
const compositeLayoutData = coreLayoutData.combineWith(layoutData)

graph.applyLayout(
  new GenericLayoutGridStage(coreLayout),
  compositeLayoutData,
)

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

Using an object initializer for easy creation of GenericLayoutGridStageData
const genericLayoutGridStage = new GenericLayoutGridStage(coreLayout)
const layoutData = new GenericLayoutGridStageData()

// Define layout grid from custom data
layoutData.layoutGridData.rowIndices = (node) => node.tag.rowIndex
layoutData.layoutGridData.columnIndices = (node) => node.tag.columnIndex

// Define split edges from custom data
layoutData.splitEdges = (edge: IEdge): boolean => edge.tag.isSplitEdge

graph.applyLayout(
  genericLayoutGridStage,
  coreLayoutData.combineWith(layoutData),
)

Type Parameters

TNode
TEdge
TNodeLabel
TEdgeLabel

Type Details

yFiles module
algorithms

Constructors

Properties

Methods