Kanten erstellen (Drag & Click)
Die Kantenerstellung ist integriert und verfügt über zwei Interaktionsstile, die durch eine Live-„Schattenkanten“-Vorschau unterstützt werden: Klick-Klick (Klicken Sie auf einen Quellknoten und dann auf ein Ziel) und Drag-and-Drop (Ziehen von einem Knoten auf einen anderen).
Klicken Sie auf Diagramm bearbeiten (oben rechts), dann auf Kante hinzufügen und verbinden Sie zwei Knoten – oder ziehen Sie einfach von einem Knoten zum anderen. Jede neue Kante löst das Datenereignis edgeAdd aus, das hier einen Toast auslöst.
js
// Edge creation lives in the full UI mode. Turn it on and the toolbar's
// Edit Graph → Add Edge starts a click-click (or drag) connect session — the
// shadow-edge preview and both interaction styles come for free.
const options = {
// Off: `full` mode brings a minimap and the data dock, and this card is about
// neither (see the Minimap and Data table cards for those).
UI: { mode: 'full', minimap: false, table: false }
}js
const data = {
nodes: [
{ id: 'alice', data: { label: 'Alice' } },
{ id: 'bob', data: { label: 'Bob' } },
{ id: 'carol', data: { label: 'Carol' } },
{ id: 'dave', data: { label: 'Dave' } },
{ id: 'erin', data: { label: 'Erin' } }
],
edges: [
{ from: 'alice', to: 'bob' },
{ from: 'alice', to: 'carol' }
]
}