d3.js force layout on non-svg elements

青春壹個敷衍的年華 提交于 2019-12-04 03:11:00

In principle there is nothing SVG-specific in D3. You will have to see if it works in practice for your particular application, but it certainly sounds feasible. Have a look in particular at the documentation for force.layout.on, which has an example showing how to update node and link positions. If you change that code to modify the relevant position attributes of the div, it should work.

Here is an example showing svg, canvas and div elements all sharing the same force-directed layout: http://bl.ocks.org/4491174

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!