0

I have a diagram I'm building using CSV. I've figured out how to user placeholders in shape labels. However I would like to also be able to use placeholders in the connections. I noticed that after I import what I already have, the connection objects don't have the Placeholder setting enabled in the Edit Data section. Is there a way to enable it from the connect json? I guess a follow up question would be to also how to set custom data to the connection.

My main goal for this question is so I can add to my connection label a sort of data-flow id possibly using the from and to so that it could be something like DF1-2.

Here is what I have so far:

## My Dataflow
# stylename: shapeType
# styles: { "docker-service": "shape=rectangle;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"}
# labelname: labelType
# labels: { "process": "%name%<br><i style=\"color:gray;\">P%Pnum%</i>", \
#           "data-flow": "tls 1.2 %dataFlowNum%", \
#           "regular": "%name%"}
# identity: gid
# namespace: jay-
# parent: rparent
# parentstyle: shape=rectangle;html=1;dashed=1;align=left;verticalAlign=bottom;fillColor=#FFE6CC;strokeColor=#D79B00;
# connect: {"from":"refstls", "to":"gid", "invert":true, "label":"TLS v1.2", "style":"curved=0;endFill=1;fontSize=11;endArrow=blockThin;endFill=1;"}
# width: auto
# height: auto
# padding: 15
# nodespacing: 40
# levelspacing: 100
# edgespacing: 40
# layout: auto
## CSV starts under this line
gid,name,rparent,Pnum,labelType,shapeType,refstls
0,Network,,,regular,docker-service,,
1,docker ingress,0,1,process,docker-service,,
2,service1,0,2,process,docker-service,1,
3,service2,0,3,process,docker-service,1
4,service3,0,4,process,docker-service,1
Jaycuse
  • 31
  • 6

2 Answers2

1

at the moment, diagrams.net doesn't support that but feel free to vote and track this feature request here: https://trello.com/c/y9IAQ9kJ/96-allow-custom-data-on-connections-when-importing-csvs

Thanks,

Marija
  • 354
  • 1
  • 1
1

I was going over the CSV example comments that explained the connector and noticed something I missed the other day that seems to do what I want it to with limitations.

The tolabel and fromlabel can be used for what I wanted.

optional fromlabel and tolabel can be used to name the column that contains the text for the label in the edges source or target (invert ignored).

Solution based on my example would be:

## My Dataflow
# stylename: shapeType
# styles: { "docker-service": "shape=rectangle;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;"}
# labelname: labelType
# labels: { "process": "%name%<br><i style=\"color:gray;\">P%Pnum%</i>", \
#           "data-flow": "tls 1.2 %dataFlowNum%", \
#           "regular": "%name%"}
# identity: gid
# namespace: jay-
# parent: rparent
# parentstyle: shape=rectangle;html=1;dashed=1;align=left;verticalAlign=bottom;fillColor=#FFE6CC;strokeColor=#D79B00;
# connect: {"from":"refstls", "to":"gid", "invert":true,"fromlabel":"Pnum","tolabel":"Pnum", "label":"-", "style":"curved=0;endFill=1;fontSize=11;endArrow=blockThin;endFill=1"}
# width: auto
# height: auto
# padding: 15
# nodespacing: 40
# levelspacing: 100
# edgespacing: 40
# layout: auto
## CSV starts under this line
gid,name,rparent,Pnum,labelType,shapeType,refstls
0,Network,,,regular,docker-service,,
1,docker ingress,0,1,process,docker-service,,
2,service1,0,2,process,docker-service,1,
3,service2,0,3,process,docker-service,1
4,service3,0,4,process,docker-service,1

The main downside of this method is that "invert" is not taken into consideration.

Jaycuse
  • 31
  • 6