Add Edge
Adds an edge between two ports on the canvas.
canvas.addEdge({ id: "edge-1", from: "port-1", to: "port-2", })
All available parameters are demonstrated in the following example:
import { BezierEdgeShape } from "@html-graph/html-graph"; canvas.addEdge({ id: "edge-1", from: "port-1", to: "port-2", shape: new BezierEdgeShape(), priority: 5, })
Parameters:
Name | Type | Description | Required | Default |
---|---|---|---|---|
id | any | Unique identifier for the edge | no | autogenerated |
from | any | Identifier of the source port | yes | |
to | any | Identifier of the target port | yes | |
shape | EdgeShape | Shape of the edge | no | BezierEdgeShape |
priority | number | Z-index of the edge | no | 0 |