how do you set a fixed link distance with d3 v4

后端 未结 3 1254
攒了一身酷
攒了一身酷 2021-02-07 12:15

All the API examples seem to be for v3 still. I\'m trying to understand how to create a force graph with links of a fixed distance, like: http://bl.ocks.org/d3noob/5141278

3条回答
  •  迷失自我
    2021-02-07 13:15

    you may try without force('center')

    let simulation = d3.forceSimulation()
      .force("link", d3.forceLink().id(function(d) { return d.id; }))
      .force("charge", d3.forceManyBody().strength(-150));
    

提交回复
热议问题