使用根节点勾选后中心力定向布局(返回中心)
我正在使用 D3.js 尝试强制定向布局。我需要的是按根(或其他选定的节点)将布局居中,并在刻度函数完成后将此节点返回到 svg(例如画布)中心(图形 alpha 较低)。是否可以?我在
找到了一个示例,但我无法制作root(当使用 aplha 或其他自定义刻度函数计算时)返回到中心(按此特定节点将布局居中)。
任何帮助将不胜感激。
I am experimenting with force directed layout using D3.js. What I need is center the layout by root (or other selected node) and return this node to the svg (e.g. canvas) center after the tick function is done (the graph alpha is low). Is it possible? I found an example at
but I am unable to make the root (when using aplha or other custom tick function calculation) return back to the center (center the layout by this particular node).
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上我是这样解决的(与之前的类似但更复杂):
Actually I solved this like this(similar to previous but more sophisticated):
尝试像这样更改强制事件处理程序:
Try to change the force event handler like this: