アップデート - 1
これが私の JSFiddleです。
この例では。DOM ロード時に最初の 2 つの div を接続しました。
このコード行で
JSPlumb
jsPlumb.connect
(
{
source: 'A',
target: 'B',
anchors: ["RightMiddle", "LeftMiddle"],
paintStyle: { strokeStyle: "#ff9696", lineWidth: 8 },
connector: ["Flowchart", { curviness: 63}],
connectorStyle: [{
lineWidth: 3,
strokeStyle: "#5b9ada"
}],
hoverPaintStyle: { strokeStyle: "#2e2aF8", lineWidth: 8 }
}
);
コネクタ スタイルを渡しています。
クエリ- ソース エンドポイントとターゲット エンドポイントを Green および Ping として表示したい。現在、青く表示されています。
オリジナル
私は最近、他の開発者が未完成のままにしていた開発を引き継ぎました。プロジェクトでは、2 つの要素間のコネクタを描画できる必要があります。そのために、元の開発者はjsPlumbを使用しました。コネクタを手動で作成すると、ライブラリは正常に動作し、結果が生成されます。しかし、今私がやりたいことは、コネクタを動的に作成することです。jsPlumb のドキュメントを読んで試してみましたが、必要な結果が得られません。
これは、手動で作成したときの様子です(ターゲット要素の色と矢印に注意してください)
しかし、自動的に作成すると、この色と矢印が得られません。これは、テスト用に作成したフィドルです。私がやっていることはjsPlumb.connect();
、パラメーターを呼び出して渡すことです。
jsPlumb.connect({
source: "page-1",
target: "page-2",
anchors: [
[1.06, 0.5, 0, 1],
[-0.06, 0.5, 0, 0]
],
endpoint: ["Dot", {
radius: 4
}],
endpointStyle: {
fillStyle: "#5b9ada"
},
setDragAllowedWhenFull: true,
paintStyle: {
fillStyle: "#5b9ada",
lineWidth: 5
},
connector: ["Straight"],
connectorStyle: [{
lineWidth: 3,
strokeStyle: "#5b9ada"
}],
connectorOverlays: [
["Arrow", {
width: 10,
length: 10,
foldback: 1,
location: 1,
id: "arrow"
}]
]
});
誰が間違いを指摘できますか?
よろしく
ジェハンゼブ・マリク