Edge tooltips not behaving correctly, nor matching the documentation
Steps to reproduce
- Given the following graph:
digraph {
node1 -> node2 [label="via tooltip, no URL", tooltip="this is a tooltip, via tooltip!"]
node1 -> node2 [label="via tooltip, with URL", URL="https://gitlab.com/graphviz/graphviz", tooltip="this is a tooltip, via tooltip!"]
node1 -> node2 [label="via edgetooltip", edgetooltip="this is a tooltip, via edgetooltip!"]
node1 -> node2 [label="via labeltooltip", labeltooltip="this is a tooltip, via labeltooltip!"]
}
-
Convert it to an SVG:
dot -Tsvg tooltip_example.gv -o tooltip_example.svg -
Load the SVG into a web browser to hover with the mouse above each edge and each of their labels, to view their tooltips.
Expected Behaviour
The edges with an edgetooltip and labeltooltip should show tooltips only on their edge or label, respectively. The two edges defined with a tooltip should show tooltips on both their edges and labels, because the label is part of the edge.
Actual Behaviour
-
Good: The edges with an
edgetooltiporlabeltooltipbehave as expected. Note that this is in constrast to the documentation (https://graphviz.org/doc/info/attrs.html#d:edgetooltip and https://graphviz.org/doc/info/attrs.html#d:labeltooltip), because supposedly these tooltips should only appear if there's aURLdefined. Please don't change this behavior! Why should it even matter whether there's a URL? For my use cases, sometimes I don't have a URL but I still want to show a tooltip.. -
Good: The contents of
tooltipis indeed always applied to the edge itself (best checked by hovering above the arrows). -
Bad: The contents of
tooltipis never applied to the edge's label, however the label does receive a tooltip containing the contents of the label, if there's aURLdefined for that edge. Not only is this redundant (why show the same thing twice?), but also a bit confusing because it's not showing the standard contents.
Long story short, the only way to show a tooltip also on the label for an edge is to define both the tooltip (or edgetooltip) as well as its labeltooltip. It's not a critical bug, but very annoying for maintenance/development.
Documentation Fix
From the attrs.html page, remove both of the following sentences, because they aren't true (nor should they be):
-
For
edgetooltipremove the sentenceUsed only if the edge has a URL or edgeURL attribute. -
For
labeltooltipremove the sentenceUsed only if the edge has a URL or labelURL attribute.
OS Version
Linux
Graphviz Version
$ dot -V
dot - graphviz version 2.43.0 (0)
Related Issues
On first glance, one might see graphviz#1425 (closed) as a duplicate but it's not, because that ticket is only about adding support for tooltips embedded within HTML labels.