documentationfor yFiles for HTML 2.6

RecursiveGroupLayoutData

Specifies custom data for the RecursiveGroupLayout.

Inheritance Hierarchy
LayoutData
RecursiveGroupLayoutData

Examples

The following example shows how to create a new instance of RecursiveGroupLayoutData 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.constant = 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 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 NULL_LAYOUT as the layout algorithm for group nodes:

const layoutData = new RecursiveGroupLayoutData()
layoutData.groupNodeLayouts.constant = RecursiveGroupLayout.NULL_LAYOUT

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

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.layout.RecursiveGroupLayoutData

Constructors

Properties

Methods