エッジを作成する(ドラッグ&クリック)
エッジ作成機能が組み込まれており、ライブ「シャドウ」をサポートする 2 つのインタラクション スタイルが備わっています。 エッジ」プレビュー: クリック-クリック (ソース ノードをクリックし、次にターゲットをクリック) ドラッグ アンド ドロップ (あるノードから別のノードにドラッグします)。
Edit Graph (右上) をクリックし、次に Add Edge をクリックして、2 つのノードを接続します。または単にノードを接続します。 あるノードから別のノードにドラッグします。新しいエッジごとに edgeAdd データ イベントが発生します。 ここで乾杯です。
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' }
]
}