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.

Categories

Layout gets skewed immediately after exporting as an SVG file

0 votes

This has only started happening in the last two months.  I've been using yEd for years and not seen this happen before.

I have a diagram laid out in hierarchical bottom to top format, and it looks well and straight.  Then I export it as an SVG.  The moment the SVG file is created the contents of the diagram are now skewed to the right for some unknown reason.  When I look at the SVG file it's also skewed in it too.

It only happens with SVG and compressed SVG's.  Not with PNG's.

Before SVG export (anonymized):


https://yed.yworks.com/support/qa/?qa=blob&qa_blobid=14686935357494456639

After SVG export (anonymized):


https://yed.yworks.com/support/qa/?qa=blob&qa_blobid=4293830908814991288

in Help by (870 points)

Would it be possible for you to copy the two nodes and the one edge I marked in the image below from your original diagram into a new diagram, then replace any texts with non-sensical text (but do not remove the text completely), save the copied three-elements diagram to GraphML, and send that GraphML? The GraphML file would then contain the styles and their configurations for further investigation without having any sensitive information.

I can't see any option to upload a file and the image uploader only takes standard image filetypes, so I've pasted the Graphml XML of the new document with the two nodes and the one edge in it. Hopefully it gets through in one piece.

Sample GraphML

Thank you very much for the sample GraphML.

Re.:

I can't see any option to upload a file [...]

Please see the upload instructions in my very first comment.

Your original diagram is stored as GraphML, right?

When you open your original diagram and select all group nodes, does this trigger the resizing already?

If not, does the resizing still happen if you turn off "Consider Label" in the "Open Group" property section and after that export to SVG?

One possible cause for the strange resizing could be inconsistent label sizes. The "Consider Label" option forces group nodes to grow in width to be wide enough to contain their label and their state icon. For this to work, yEd has to calculate the size of the group node labels. If the size calculation now returns larger values than at the time you created the diagram, your labels will "grow" and consequently your nodes will grow.

Label size calculation depends on operating system text measuring as well as Java text measuring. Thus any change to your machine or to yEd that affects text measuring might result in the undesired resize effect you are experiencing. E.g. if you work on different operating systems, text measuring will differ. A system update that affects fonts might change text measuring. Changing the Java version on which yEd runs might change text measuring.

Unfortunately, there is one thing that does not fit the "text measuring changed" theory: if text measuring did indeed change and your labels do grow in response to the changed measuring, the undesired growth should happen right when your diagram is first displayed.
I cannot think of a reason why this would happen only after SVG export.

You could try to verify the "text measuring changed" theory using the following approach:

  1. Start yEd.
  2. Open an empty document.
  3. In a second tab, open your original diagram.
  4. In the original diagram, find a group node that is connected to one of the skewed edges.
  5. In the empty document, create an empty group node with the same style and style configuration as the group node from step 4.
  6. Edit the label of the new group node and set to the same text as the the group node from step 4.
  7. Save the new document as a GraphML file.
  8. Open the GraphML file of your original diagram and the GraphML file of the new diagram in a text editor.
  9. In both files, find the <y:NodeLabel ...>...</y:NodeLabel> element that encloses the text from step 6.
  10. Compare the values of the width attributes of the elements from step 7.
Fixed!  I selected all group nodes and observed that I had mixed states for the "Consider Label" option in the "Open Group" tab.  I deselected it for all group nodes and then attempted an SVG export.  The problem went away and no resizing occurred!  Many thanks for your help on this Thomas.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Legal Disclosure | Privacy Policy
...