I'm trying to create a callgraph similar to kcachegrind using graphviz. See e.g.,
I thought I could create the percentage bar using a table with a row using two cells, setting their size and background color. This sort of works, except that by default it will make the bar as wide as the widest column (the function label). If I add fixedsize="TRUE"
the cells get the expected width, but now space is inserted between the cells to make the total width still equal to the total table width. I also tried nested tables, but that seems to give the same result. cellspacing(0)
only seems to affect vertical spacing.
I had a look at the kcachegrind source. They seem to just reserve a line and do the percentage bar themselves (parse the dot layout info and draw the nodes directly on the canvas). This suggests it it may not be possible to do this in graphviz. The related solution I can opt for is to post-process the SVG, but that seems pretty ugly ...
You can use colorList in the bgcolor
attribute of the cell to imitate a progressbar.
Example:
digraph {
example1 [
shape=plain
label=<
<table cellborder="0" cellspacing="5">
<tr><td colspan="2">Title</td></tr>
<tr><td border="1" width="50" bgcolor="#6da8ce;0.25:white"></td><td color="white">25%</td></tr>
</table>
>
]
example2 [
shape=plain
label=<
<table cellborder="0" cellspacing="5">
<tr><td colspan="2">Title</td></tr>
<tr><td border="1" width="50" bgcolor="#6da8ce;0.71:white"></td><td color="white">71%</td></tr>
</table>
>
]
}
Result: