Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doxygen: Is it possible to control the orientation of dependency graphs?

Tags:

dot

doxygen

Up until today, I'd been using an "ancient" version (1.4.7) of doxygen (+dot) and it typically drew graphs with a vertical orientation, e.g.
enter image description here

.. but with a more recent one (1.8.6 as distributed via Ubuntu), the graphs seem to be horizontal, i.e.
enter image description here

The problem with the horizontal orientation is that many of the graphs go well off the right edge of the window and so you have to do "2D" scrolling to see the data.

I've looked in the doxygen web pages but couldn't see if there was an option to tell dot to draw them with the vertical orientation. Does anyone know if such an option exists?

like image 456
Simon F Avatar asked Oct 06 '15 10:10

Simon F


1 Answers

There is a similar question asked in 2014 which I am duplicate answering: Flip doxygen's graphs from top-to-bottom orientation to left-to-right

After looking for the same myself and finding nothing, the best I can offer is a hack using the graph attribute rankdir.

Step 1) Make sure Doxygen keeps the dot files. Put DOT_CLEANUP=NO in your confige file.

Step 2) find your dot files that Doxygen generated. Should be in the form *__incl.dot. for steps below I will refer to this file as <source>.dot

Step 3a) Assuming the dot file did not explicitly specify rankdir (usually it is TB" by default), regenerate the output with this command.

dot -Grankdir="LR" -Tpng -o<source>.png -Tcmapx -o<source>.map <source>.dot 

Step 3b) If for some reason rankdir is specified in the dot file, go into the file and add the rankdir="LR" (by default they are rankdir is set to "TB").

digraph "AppMain"
{
  rankdir="LR";
...

Then regenerate the output with:

dot -Tpng -o<source>.png -Tcmapx -o<source>.map <source>.dot 

You need to redo this after every run of Doxygen. A batch file might be handy, especially if you want to process all files. For step 3b, batch replacing text is outside of the scope of this answer :). But here seems to be a good answer:

How can you find and replace text in a file using the Windows command-line environment?

like image 154
Michael Avatar answered Oct 24 '22 03:10

Michael