documentationfor yFiles for HTML 2.6

HierarchicLayoutData

Specifies custom data for the HierarchicLayout.

Inheritance Hierarchy
LayoutData
HierarchicLayoutData

Default Values of Properties

Examples

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

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

// group all edges on their source side
layoutData.sourceGroupIds = (edge) => edge.sourceNode
// Use the stroke width of the style as edge thickness
layoutData.edgeThickness = (edge) =>
  edge.style instanceof PolylineEdgeStyle ? edge.style.stroke.thickness : 1

graph.applyLayout(new HierarchicLayout(), layoutData)const layoutData = new HierarchicLayoutData()

// group all edges on their source side
layoutData.sourceGroupIds = (edge: IEdge) => edge.sourceNode
// Use the stroke width of the style as edge thickness
layoutData.edgeThickness = (edge: IEdge) =>
  edge.style instanceof PolylineEdgeStyle ? edge.style.stroke!.thickness : 1

graph.applyLayout(new HierarchicLayout(), layoutData)

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

Using an object initializer for easy creation of HierarchicLayoutData
const layoutData = new HierarchicLayoutData({
  // group all edges on their source side
  sourceGroupIds: (edge) => edge.sourceNode,
  // Use the stroke width of the style as edge thickness
  edgeThickness: (edge) => edge.style.stroke.thickness
})

graph.applyLayout(new HierarchicLayout(), layoutData)const layoutData = new HierarchicLayoutData({
  // group all edges on their source side
  sourceGroupIds: (edge: IEdge): any => edge.sourceNode,
  // Use the stroke width of the style as edge thickness
  edgeThickness: (edge: IEdge): number =>
    (edge.style as PolylineEdgeStyle).stroke!.thickness
})

graph.applyLayout(new HierarchicLayout(), layoutData)

Type Details

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

See Also

Constructors

Properties

Methods