我有一个带有源/目标的对象数组,从邻接列表生成。它看起来像这样:
0: Object
source: Object
name: "test1"
target: Object
name: "test2"
我将节点绘制成圆圈,如下所示:
var node = svg.selectAll(".node")
.data(node_list)
.enter().append("circle")
.attr("class", "node")
.attr("transform", function(d, i) {
return "translate(" + (Math.cos(2*Math.PI/node_list.length*i)*radius) +
"," + (Math.sin(2*Math.PI/node_list.length*i)*radius) + ")";
})
.attr("fill", "gray")
.attr("r", 10);
现在我想要合并边缘数据。有没有办法告诉d3在正确的节点之间画一条弧?
这是我的代码:
var arc = d3.svg.arc()
.innerRadius([radius+20])
.outerRadius([radius+40])
.startAngle() //?? Usually I put something like d.x, but there is no "x"
.endAngle() //?? same problem