drawing hierarchical tree with orthogonal lines ( HV-Drawing – Binary Tree)

泄露秘密 提交于 2019-12-11 07:52:58

问题


I need to work on drawing a hierarchical tree structure (HV-Drawing – Binary Tree) with orthogonal lines(straight rectangular connecting lines) between root and children ( like the following: http://lab.kapit.fr/display/visualizationlayouts/Hierarchical+Tree+layout ). I want to know if there are any open source examples of the algorithm of drawing trees like that so that I can implement the same algorithm in actionscript. Thanks Palash


回答1:


I did a C# version and put the code up on CodeProject. It's at:

http://www.codeproject.com/KB/WPF/LayeredTreeDraw.aspx

There's a generic part which gives the positions of all the nodes and a WPF specific implementation which actually draws everything using either straight lines or the orthogonal lines you're looking for.




回答2:


Here is my Python 3 realization: GitLab (this is internal project, GitLab registration required).

The program consists of only one file, so the installation is very simple (clone the repository and run hv-drawing.py with necessary arguments). Also the repository contents some examples of graphs for drawing.

The code is well-commented, so you can learn the algorithm on its realization.



来源:https://stackoverflow.com/questions/2897575/drawing-hierarchical-tree-with-orthogonal-lines-hv-drawing-binary-tree

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