Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

How to add a tooltip by default when importing SVG symbols

+1 vote

I just started using yEd and was importing some Amazon AWS icons (SVG files on the file system, originally downloaded as a ZIP from http://aws.amazon.com/architecture/icons/) as symbols into a custom palette. However, I was extremely disappointed because the imported symbols did include any descriptive tooltip/hover text.

Given that such text could've been based on either the filename or, at least in the case of my particular SVGs, the "id" attribute of the first "g" element (without `display="none"` if we get especially particular) within the SVG, this seems very unfortunate.

Is there something else I can do with my SVG file in order to get these palette tooltips by default when importing the SVGs? It is easier to make the adjustment on the SVG files rather than updating an exported GraphML file in which I have no idea which SVG blurb corresponds to the original SVG file name/location/ID.

asked Mar 10, 2015 in Help by JamesMGreene (140 points)
edited Mar 10, 2015 by thomas.behr

2 Answers

+1 vote

Unfortunately, yEd is not able to automatically generate descriptive tool tip texts for imported symbols.

However, you do not need to edit any GraphML files for specifying tool tip texts manually. After importing new symbols, right-click the corresponding palette section to open its context menu and choose "Convert to Document". In the new document, select the symbol for which you want to specify a tool tip text and enter the desired text as "Palette ToolTip" in section "Data" in the properties view in yEd's lower right corner. Once done with the texts, open the palette section's context menu once more and choose "Adopt from Document".

By the way, your suggestion of using the id of the first g element without display="none" would result in the tool tip text "Layer_1" for 141 out of the 166 SVG symbols in AWS_Simple_Icons_svg_eps.zip. Personally, I do not see any benefit in lots and lots of "Layer_1" descriptions.

answered Mar 10, 2015 by thomas.behr [yWorks] (126,270 points)
Your recommended approach doesn't seem to work, see screenshot: http://pbrd.co/18bYkvs

Running yEd 3.14 on Mac OS X 10.10.
Well, I suggest you zoom in far enough to be able to differentiate the symbols in the editor. E.g. zoom factor 1 should do nicely and is easy to get thanks to the "1:1" button in the tool bar (13th from left).

That said, the screen shot is rather suboptimal since it does not show the properties view and its "Data" section for the selected element.
0 votes
I've faced similar problem.

If you can update the <title> of each SVG and import it to your custom pallete - here's a script which will update tooltip in yed graphml files with title from imported SVG

https://github.com/tciops/pearls/blob/master/graphml.pl

Code is not the best but it worked for me

Please add this feature to yed - either SVG file name or <title> from SVG content could be used as tooltip and I believe it won't be too much effort for you guys
answered Aug 21, 2017 by n0body (190 points)
Good luck with that script. It relies on GraphML internal IDs for identifying tooltip nodes in the XML tree. Unfortunately, these IDs are by no means fixed and are generated anew each time a GraphML document is created. I.e. the ID for the tool tip element does not need to be "d4" as assumed by the script - and if the tool tip ID is something other than "d4", the script will destroy the GraphML document.
I've chosen d4 because in every custom pallette I found this:
<key attr.name="Palette ToolTip" attr.type="string" for="node" id="d4"/>
So it seems yEd always  (or almost always) chooses d4 as tooltip for nodes in custom palletes
Feel free to update it so it will get the id from the line above

Moreover - the script does not overwrite your graphml - it is left for the user.

Since you are a yWorks employee - what do you think about getting tooltip from SVG title tag?
Imprint | Privacy Policy