8

我已经实现了这个http://jsbin.com/omokap/3/edit

在此处输入图像描述

但是,我想取消图形的动态行为(例如在 dragend 状态下,但这仅适用于单个节点)并将节点放置在设置点中,取自 json.

我已经看到了这个问题Moving fixed nodes in D3Fix Node Position in D3 Force-Directed Layout。我不明白如何在我的示例中使用它们。

有人可以帮帮我吗?

4

1 回答 1

10

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}

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

for my purpose works fine.

于 2013-07-17T10:12:52.880 回答