-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add configuration options to set rankdir for dot graphs #11440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
DOT_RANKDIR_GROUP_COLLABORATION is too long (31 > 23 characters).
and DotGraph::writeGraphFooter(). This applies the DOT_GRAPH_ATTR, DOT_COMMON_ATTR, DOT_EDGE_ATTR, and DOT_NODE_ATTR to the VHDL flowcharts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this many extra settings. I already made some comments about this in #11440 (comment) and the total concept of handling the attributes for dot
should in my opinion be reconsidered.
\c DOT_GRAPH_ATTR is common attributes for graphs. | ||
For details please see | ||
<a href="https://graphviz.org/doc/info/attrs.html">Node, Edge and Graph Attributes specification</a>. | ||
<br>The default value is:<br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text for the default value is generated automatically, so sentence should not be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except when I run doxygen -g
, the sentence isn't generated but the value is inserted (with a period after and no space or new line).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the behavior is different since this is type='list'
not type='string'
.
@@ -3802,6 +3802,130 @@ where `loc1` and `loc2` can be relative or absolute paths or URLs. | |||
]]> | |||
</docs> | |||
</option> | |||
<option type='list' id='DOT_GRAPH_ATTR' format='string' depends='HAVE_DOT' | |||
defval='bgcolor=\"transparent\"'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the double quotes should be escaped (\"
), it is not necssary as the string is embedded in single quotes , probably the double quotes can removed all together (see e.g. DOT_COMMON_ATTR
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Escaping the double quotes is necessary to create the same output as before:
bgcolor="transparent";
I think having un-escaped "
would confuse the parsing of the doxyfile?
You are correct that dot also accepts bgcolor=transparent
, but I was trying to keep the output the same.
</docs> | ||
<value name='bgcolor=\"transparent\"'/> | ||
</option> | ||
<option type='string' id='DOT_RANKDIR_CALL' format='string' depends='HAVE_DOT' defval='LR'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the default be the empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If DotCallGraph::m_inverse was false, rankdir was "LR". I am trying to preserve the previous behavior.
QCString rankdir = Config_getString(DOT_RANKDIR_CALL); | ||
if (rankdir.size() >= 2 && m_inverse) | ||
{ | ||
std::swap(rankdir[0], rankdir[1]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you get 2 or more values on the rankdir part?
What happens with the values 3, 4, ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rankdir is supposed to be only "TB", "BT", "LR", or "RL"; this is supposed to swap the characters in the string: "TB" becomes "BT", etc.
My version of dot
appeared to reset to its default (TB) if given an invalid string, e.g. "foo", so I saw no reason to explicitly check and replace when swapping does the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which version of dot
do you use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dot -V
dot - graphviz version 2.43.0 (0)
I had tested the behavior with an invalid rankdir using a valid rankdir in DOT_GRAPH_ATTR and setting an invalid DOT_RANKDIR_INCLUDE.
I did not see the gear icon, but replacing "closes" with "references" in the comment appears to have removed it.
Adding commands to supply dot statements that would be inserted at the end of Generalizing this from rankdir to any graph attribute would probably require changes to how DotClassGraph and DotCallGraph behave. With DotClassGraph's unique dynamic selection of rankdir, it would be easiest to remove, but maybe something like:
DotCallGraph's inverse direction may be achieved with appending
I don't think this is significantly different to how the dot graphs are already handled. See https://www.doxygen.nl/manual/commands.html#cmdgroupgraph, etc.; and the configuration options: CLASS_GRAPH, COLLABORATION_GRAPH, GROUP_GRAPHS, TEMPLATE_RELATIONS, INCLUDE_GRAPH, INCLUDED_BY_GRAPH, CALL_GRAPH, CALLER_GRAPH, GRAPHICAL_HIERARCHY, and DIRECTORY_GRAPH. |
|
doxygen-test-rankdir_with-call-graphs.tar.gz |
These commits add configuration options to set rankdir for dot graphs.
References #4453 see DOT_GRAPH_ATTR
References #9869 see DOT_RANKDIR_CLASS
I'm not sure what config.xml is supposed to include and setting a defval for DOT_GRAPH_ATTR caused it to print it in the generated doxyfile, but without the preceding newline and "# The default value is: ".
I kept the inverse behavior of the call graphs and the strange switching to LR with DotClassGraph.
The final commit is optional and changes VHDL flow charts, applying the other global attributes to the dot graph.
For quick testing I created a simple class hierarchy:
doxygen-test-rankdir.tar.gz
I started getting a nonsense warning from gcc after adding DOT_RANKDIR_DIR_DEP:
I have not investigated, and am not planning on it, but it would also be nice if there were doxygen commands to be able to set the rankdir on a per graph basis, e.g. some graphs in the same category may be more compact LR, others TB.