问题
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