loov / goda

Go Dependency Analysis toolkit
MIT License
1.37k stars 45 forks source link

graph: support for vertical direction #23

Open kravemir opened 5 years ago

kravemir commented 5 years ago

First, I would like to say, that this is a very useful project/tool, and I have been exactly for :+1:

goda graph github.com/loov/goda/...:root | dot -Tsvg -o graph.svg

Regarding the issue. I'm visualizing internal package dependencies of my wip/hobby project, and there are many levels. In combination with "longer" package names, the graph is quite very wide, aspect ratio of ~ 7:1.

Would it be possible, to add flag --direction vertical to set graph's direction to be vertical? Or, maybe --direction top-bottom or --direction to-bottom indicating also, that it goes from top to bottom, not just any "vertical".

egonelbre commented 5 years ago

Honestly, I would like it to work as well. :D... currently the top-to-bottom rankdir is a mess mostly. It ends up much worse, that's why I didn't expose the dot option for it. I'll introduce it when it can reliably give decent output.

You can override the rankdir with:

goda graph github.com/loov/goda/...:root | sed s/rankdir=LR;/rankdir=TB;/ | sed s/tailport=e// | dot -Tsvg -o graph.svg

I'll add graphml support at some point https://github.com/loov/goda/issues/24, which would allow to open in yEd and do better layouting.