documentationfor yFiles for HTML 3.0.0.3

RecursiveGroupLayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel>

Specifies custom data for the RecursiveGroupLayout.

Inheritance Hierarchy

Examples

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

Creating an instance of RecursiveGroupLayoutData
// Create layout data for both the RecursiveGroupLayout and the layout that's being run
const recursiveGroupLayoutData = new RecursiveGroupLayoutData()
// Use Orthogonal layout for group node contents
recursiveGroupLayoutData.groupNodeLayouts = new OrthogonalLayout()

const organicLayoutData = new OrganicLayoutData()
const orthogonalLayoutData = new OrthogonalLayoutData()
// Configure the other layout data objects ...

// Wrap both into a CompositeLayoutData
const layoutData = new CompositeLayoutData(
  recursiveGroupLayoutData,
  organicLayoutData,
  organicLayoutData,
)

// Run the layout - The top-level layout will be done by an OrganicLayout
graphComponent.graph.applyLayout(
  new RecursiveGroupLayout(new OrganicLayout()),
  layoutData,
)

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

Using an object initializer for easy creation of RecursiveGroupLayoutData
// Create layout data for both the RecursiveGroupLayout and the layout that's being run
const recursiveGroupLayoutData = new RecursiveGroupLayoutData({
  // Use Orthogonal layout for group node contents
  groupNodeLayouts: new OrthogonalLayout(),
})

const organicLayoutData = new OrganicLayoutData()
// Configure the organic layout data ...
const orthogonalLayoutData = new OrthogonalLayoutData()
// Configure the orthogonal layout data ...

// Wrap all three into a CompositeLayoutData
const layoutData = new CompositeLayoutData(
  recursiveGroupLayoutData,
  organicLayoutData,
  orthogonalLayoutData,
)

// Run the layout - The top-level layout will be done by an OrganicLayout
graphComponent.graph.applyLayout(
  new RecursiveGroupLayout(new OrganicLayout()),
  layoutData,
)

Another fairly useful way of using RecursiveGroupLayout is to just do a top-level layout and leave the contents of the group nodes alone. This can be done by using FIX_CONTENT_LAYOUT as the layout algorithm for group nodes:

const layoutData = new RecursiveGroupLayoutData()
layoutData.groupNodeLayouts = RecursiveGroupLayout.FIX_CONTENT_LAYOUT

graphComponent.graph.applyLayout(
  new RecursiveGroupLayout(new OrthogonalLayout()),
  layoutData,
)

Type Parameters

TNode
TEdge
TNodeLabel
TEdgeLabel

Type Details

yFiles module
algorithms

Constructors

Properties

Methods