开发者

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

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 follow开发者_运维问答ing: 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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜