documentationfor yFiles for HTML 2.6

FixNodeLayoutData

Specifies custom data for the FixNodeLayoutStage.

Inheritance Hierarchy
LayoutData
FixNodeLayoutData

Examples

The following example shows how to create a new instance of FixNodeLayoutData and use it with an FixNodeLayoutStage:

Creating an instance of FixNodeLayoutData
// Create layout data for both the FixNodeLayoutStage and the layout that's actually being run

// first create and configure the actual layout data object
const organicLayoutData = new OrganicLayoutData()
// Configure the organic layout data object ...

const fixNodeLayoutData = new FixNodeLayoutData()
fixNodeLayoutData.fixedNodes = graphComponent.selection.selectedNodes

// Wrap both into a single layout data
const layoutData = fixNodeLayoutData.combineWith(organicLayoutData)

// Run the layout
graphComponent.graph.applyLayout(
  new FixNodeLayoutStage(new OrganicLayout()),
  layoutData
)

In many cases the complete initialization of FixNodeLayoutData can also be done in a single object initializer:

Using an object initializer for easy creation of FixNodeLayoutData
// Create layout data for both the FixNodeLayoutStage and the layout that's actually being run
const fixNodeLayoutData = new FixNodeLayoutData({
  fixedNodes: graphComponent.selection.selectedNodes
})
const organicLayoutData = new OrganicLayoutData({
  // Configure the other layout data object ...
})

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

// Run the layout
graphComponent.graph.applyLayout(
  new FixNodeLayoutStage(new OrganicLayout()),
  layoutData
)

Type Details

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

Constructors

Properties

Methods