且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

d3js使用固定节点创建强制布局

更新时间:2023-11-26 23:14:46

该解决方案是将x,y坐标和fixed:true像这样简单地插入节点对象

the solution is simple insert into the nodes object x,y coordinates and fixed:true like this

{ name: "Sara", id:"1", x:239.31191418045182, y:296.78520431471384, fixed:true},
{ name: "Raul", id:"2", x:261.1651006560272, y:200.78448049334696, fixed:true},
{ name: "Stefano", id:"3", fixed:false},
{ name: "Michele", id:"4", fixed:false}

这是一个有效的示例 http://jsbin.com/omokap/8/edit 请添加您自己的d3js库

this is a working example http://jsbin.com/omokap/8/edit please add yourself d3js library.

出于我的目的,效果很好.

for my purpose works fine.