Foblex Flow
Introduction
Overview
Nodes
Custom Nodes
Drag Handle
Node Selection
Resize Handle
Rotate Handle
Grouping
Updated
Drag to Group
Updated
Stress Test
Stress Test with Connections
Connectors
Node as Connector
Connector Inside Node
Connector Outlet
Limiting Connections
Connection Rules
New
Connectable Side
Connections
Drag to Connect
Drag to Reassign
Updated
Create Node on Connection Drop
Remove Connection on Drop
Assign Node to Connection on Drop
Auto Snap
Connection Types (Straight, Bezier, Step)
Custom Connection Type
Connection Behaviours
Connection Markers
Connection Text
Deprecated
Connection Center
Deprecated
Connection Content
New
Custom Connections
Extensions
Add Node from Palette
Selection Area
Help in Positioning
Grid System
Minimap
Zoom
Background
Advanced
Cut/Copy/Paste
New
Undo/Redo
Undo/Redo V2
New
Dagre Layout (Directed Graph)
ELKJS Layout (Directed Graph)
Drag Start/End Events
Custom Event Triggers
Pro Examples
Visual Programming
DB Management
UML Diagram
Tournament Bracket
Foblex Flow

Dagre Tree

Description

This example demonstrates automatic graph layout using dagre.js together with Foblex Flow and Angular. The component builds a tree from a set of nodes and edges, computes positions using dagre.layout(graph), and renders nodes and connections on the Flow canvas.

What this example shows

  • Switching layout direction: Left→Right and Top→Bottom.
  • Auto Layout toggle — when enabled, flow.reset() is called before each recalculation and nodes are repositioned using Dagre results.
  • Automatic viewport fitting: fitToScreen(...) after the flow has been loaded.

Technical details

  • The graph is built using dagre.graphlib.Graph: nodes come from GRAPH_DATA, edges are defined by parentId.
  • After calling dagre.layout, node coordinates are mapped into nodes() with { x, y } positions, and edges into connections().

Example

[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/dagre-layout/dagre-layout.html [component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/dagre-layout/dagre-layout.ts [component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/dagre-layout/dagre-layout.scss [common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss

Edit this page on GitHub
In this article