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

if yED is not page oriented how are the node coordinates calculated?

0 votes
Hi guys

I am reading the other questions others posted about setting the canvas size and from what I gather there is no canvas size in yEd...it is dictated by the paper size when you export or print the graph

How about the node coordinates that are included in the .graphml file? What is used to calculate those? Is it the default page size of the default printer?
in Help by (150 points)

1 Answer

+1 vote

yEd works with an abstract coordinate system that is not related to any paper size. The coordinates written to GraphML files are the coordinates of the elements in yEd's abstract coordinate system. So, coordinates are not calculated when saving a diagram, because coordinates already exist.

E.g. try the following to understand how that works:

  1. Create a new empty diagram.
  2. Create a single new node.
  3. Select the node.
  4. Move the node to an arbitrary location.
  5. Check the node's x- and y-coordinates in the properties view in yEd's lower right corner.
  6. Save this diagram to a new GraphML file.
  7. Open the new GraphML file in a text editor.
  8. Compare the coordinates in the file with the coordinates displayed in yEd.
  9. Move the node to a different location.
  10. Use "Save As" to save your diagram once again, but to a second GraphML file.
  11. Open the second GraphML file in a text editor again.
  12. Compare the coordinates in the second file to the coordinates in the first file and the coordinates displayed in yEd.

 

In other words, the coordinates in yEd are not related to a specific unit of measurement. I.e. if you place a node at position (0, 0), another node at position (100, 0), and a third node at position (200, 0), that does not mean that the first node is 100 pixel or inch or millimeters from the second node. All it means is that the third node is twice as far from the first node as the second node.

by [yWorks] (161k points)
edited by
Ok that is fine. I use yEd to create a graphml file which I import in a python script that is used to automate the translation of that graph in a network simulator topology. I know that the simulator has a canvas of a certain size.
What do I need to do in order to keep the yEd diagram coordinates between certain limits? Is there a way to configure that ?

No, there is no way to restrict coordinates in yEd.

Off the top of my head, I can think of two approaches:

  1. yEd includes a "Geometric Transformation" tool which can be used to move all (or some) elements in a diagram and to scale the coordinates of all (or some) elements in a diagram. As a result, you could use "Geometric Transformations" to fit your diagram into the range of coordinates supported by your simulator before saving your diagram to GraphML.
  2. Transform the yEd coordinates into the coordinate range supported by your simulator in your python script. (This requires only very simple math.)
I wish I thought about that before asking...yeah normalizing the coordinates at the python end is much better from all points of views! Thanks a lot!
You are welcome.
Legal Disclosure | Privacy Policy
...