[英]d3js multiple targets to a single node
我正在使用d3js創建視覺對象,該視覺對象應該可以幫助我顯示某些javascript文件的依賴關系。
在d3中顯示源和目標之間關系的當前格式為:
var links = [
{ source: "A", target: "X"},
{ source: "Z", target: "Y"},
{ source: "A", target: "Z"},
{ source: "A", target: "W"},
];
能夠使用d3和/或Javascript的人可以告訴我如何更改代碼,以便可以添加多個目標,例如:
var links = [
{ source: "A", target: "X", "Y", "Z"},
{ source: "Z", target: "Y"},
{ source: "A", target: "Z"},
{ source: "A", target: "W"},
];
如果要在target
屬性中列出幾個值,則可以使用Javascript數組
像這樣:
var links = [
{ source: "A", target: ["X", "Y", "Z"]},
{ source: "Z", target: "Y"},
{ source: "A", target: "Z"},
{ source: "A", target: "W"},
];
該數組是使用[]
構造函數直接創建的。 其實links
也是一個數組
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.