Skip to content

NgDiagramNodeService

The NgDiagramNodeService provides methods for manipulating nodes in the diagram.

private nodeService = inject(NgDiagramNodeService);
// Move nodes by a delta
this.nodeService.moveNodesBy([node1, node2], { x: 10, y: 20 });
  • NgDiagramBaseService

bringToFront(nodeIds?, edgeIds?): void

Brings the specified nodes and edges to the front (highest z-index).

string[]

Array of node IDs to bring to front.

string[]

Array of edge IDs to bring to front.

void


moveNodesBy(nodes, delta): void

Moves nodes by the specified amounts.

Node[]

Array of nodes to move.

Point

The amount to move the nodes by.

void


resizeNode(id, size, position?, disableAutoSize?): void

Resizes a node to the specified dimensions. Node.autoSize must be set to false to resize a node.

string

The ID of the node to resize.

Size

The new size of the node.

Point

Optional new position of the node.

boolean

Optional flag to disable auto-sizing.

void


rotateNodeTo(nodeId, angle): void

Rotates a node to the specified angle.

string

The ID of the node to rotate.

number

The rotation angle in degrees.

void


sendToBack(nodeIds?, edgeIds?): void

Sends the specified nodes and edges to the back (lowest z-index).

string[]

Array of node IDs to send to back.

string[]

Array of edge IDs to send to back.

void