Draw a binary tree

南笙酒味 提交于 2019-12-08 08:21:33

问题


I'm looking for a js lib which allows the user to draw a binary tree : add/remove a leaf, add/remove a parent node, etc.

I've found many libs but most of them are made for data visualization only (eg: d3), not drawing from the browser.

Does this even exist ?

Thanks!


回答1:


Tree-model-js has animated example on main page by svg. You can copy and use it.




回答2:


Have a look at existing stuff to draw graphs (a tree is a graph):

Pure JavaScript Graphviz equivalent

You may also write it yourself by drawing to a HTML canvas for example:

https://developer.mozilla.org/en-US/docs/HTML/Canvas/Drawing_graphics_with_canvas



来源:https://stackoverflow.com/questions/21231245/draw-a-binary-tree

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