getPolylinePath()

The function getPolylinePath returns everything you need to render a polyline edge between two nodes.

export function CustomEdge(props: EdgeProps) {
  const [edgePath] = getPolylinePath({
    sourceX: props.sourceX,
    sourceY: props.sourceY,
    targetX: props.targetX,
    targetY: props.targetY,
    bends: props.data?.yData?.bends ?? []
  })

  return ( <BaseEdge path={edgePath} {...props} /> )
}

Parameters

NameDescriptionType
params
The coordinates of the source point, the target point, and the bends.
PolylinePathProps

Returns

TypeDescription
[
path: string,
labelX: number,
labelY: number,
offsetX: number,
offsetY: number
]
Returns an array that contains the edge path, the center location of the edge, e.g. to place a label, and the relative center location of the edge.