HTMLGraph

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:

NameTypeDescriptionRequiredDefault
idanyUnique identifier for the edgenoautogenerated
fromanyIdentifier of the source portyes
toanyIdentifier of the target portyes
shapeEdgeShapeShape of the edgenoBezierEdgeShape
prioritynumberZ-index of the edgeno0