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.


Building file with python: getting text on the boxes

+1 vote

I am using python pygraphml to build my nodes, and 99% of stuff is working fine, but I can't figure out how to make the lables (text) appear in the boxes, and opening the graphml file in yEd changes my node ID.

Does anyone have any tips?


Before opening node:

 <node id=""/>

After opening node:

 <node id="n1">
      <data key="d4"/>
      <data key="d5">
          <y:Geometry height="30.0" width="30.0" x="-15.0" y="-15.0"/>
          <y:Fill color="#FFCC00" transparent="false"/>
          <y:BorderStyle color="#000000" type="line" width="1.0"/>
          <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" hasText="false" height="4.0" modelName="custom" textColor="#000000" visible="true" width="4.0" x="13.0" y="13.0">
              <y:SmartNodeLabelModel distance="4.0"/>
              <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
          <y:Shape type="rectangle"/>
in Help by (130 points)

2 Answers

+1 vote

Node IDs are not text. They are an internal detail of the format and in no way meant to be visually represented. So, if you have IDs that represent data that is important to you and thus need to be visualized, do not represent that data as node IDs. Either use labels and label texts or use custom properties. You can find out how labels (and label texts) work by creating a very simple diagram with one node and some text, saving said diagram, and inspecting the resulting GraphML file. The same approach works for custom properties.

by [yWorks] (150k points)
0 votes
Instead of pygraphml, use https://github.com/jamesscottbrown/pyyed :-)
by (1k points)
Legal Disclosure | Privacy Policy