d3.js: how to create “force-directed graph clusters”

南笙酒味 提交于 2019-12-05 09:44:30

You could try integrating the example hull code with the force nodes.

Hull: http://bl.ocks.org/mbostock/4341699

Force Layout: http://bl.ocks.org/mbostock/1021841

This is the answer I provided in the comments:

http://bl.ocks.org/donaldh/2920551

See the force-cluster example in D3's repository.

trevorism

If you are referring to the code that creates the circular nodes in the graph:

   var node = svg.selectAll("circle.node")
       .data(json.nodes)
     .enter().append("circle")
       .attr("class", "node")
       .attr("r", 5)
       .style("fill", function(d) { return color(d.group); })
       .call(force.drag);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!