Import from CSV : custom connector label

166 views
Skip to first unread message

Kosmas Ntouskos

unread,
Feb 17, 2021, 8:30:55 PM2/17/21
to diagrams.net Q&A
Hello all,

I'm trying to generate a network diagram from CSV data.
It's important that exact port number to port number for network connections is shown.

I'm attaching a mock up of what I'm trying to achieve and am open to suggestions if there's a better way.
I'm currently noting the port mappings on the connector.
mockup.png

My problem with importing from CSV is that I've found no way to dynamically customize the "label" for connectors.
And, assuming that's possible, I expect to hit a second issue of being unable to have one-to-many relations with a different label for each.

My current CSV would be something like this :
## test
# label: %name%
# parent: %parent%
# style: shape=rectangle;fillColor=#dae8fc;strokeColor=#6c8ebf;
# connect: {"from":"id", "to":"target", "invert":true, "label":"port", "style":"curved=0;endArrow=blockThin;endFill=1;"}
## CSV starts under this line
id,name,port,target
r1,router1,eth5-to-eth1,sw
sw,switch,eth2-to-eth0,pc1
sw,switch,eth3-to-eth1,r2
sw,switch,eth4-to-eth0,pc2
r2,router2,eth5-to-eth1,r3
r3,router3,eth2-to-eth0,pc3
pc1,desktop1,,,
pc2,desktop2,,
pc3,server,,

I'm currently able to pull this off by inserting as Mermaid, but the resulting diagram cannot be edited by hand and is generally not as good-looking as native diagrams.

Mermaid example :
graph TD;
  ROUTER1-- port1-to-eth0 -->PC1
  ROUTER1-- port2-to-port1 -->ROUTER2
  ROUTER2-- port5-to-port1 -->SWITCH
  SWITCH-- port5-to-eth0 -->PC2


Any pointers?
Reply all
Reply to author
Forward
Message has been deleted
0 new messages