Why is my arrow taking a convoluted path ?

0 votes
asked Jan 22, 2021 in Question / help by Alroc (140 points)

Hi i'm trying to make a component diagram with arrows between component 

@startuml
skinparam ranksep 10
skinparam nodesep 100

package "OC_DET"{
[R-OC_DET-PP_I] -- [R-OC_DET-T_x]
[R-OC_DET-PP_I] -r- [R-OC_DET-EST]
[R-OC_DET-EST] -- [R-OC_DET-SOA]
[R-OC_DET-SOA] -- [R-OC_DET-DET_SC]
[R-OC_DET-DET_SC] -- [R-OC_DET-DET]
[R-OC_DET-DET] -- [R-OC_DET-SAFE_OFF_SC]
[R-OC_DET-EST] -r- [R-OC_DET-SAFE_OFF]


[R-OC_DET-DET] -[norank,dashed] [R-OC_DET-SAFE_OFF]

}
@enduml

If you test this code http://www.plantuml.com/plantuml/png/RP3H2e8m58RlprCChnlO6oYcq9MItibX7DgeCATi1a7qxXcxQ6jU37O-llqx_9bTo2oFyGvskEcP38tCa1wicja-zQ2Uf78m1PZfFD15iQGknA7iaXVq9-xkl6d44Hddx8SwySJOCBvIjXr2E8OPRPqZX6Ceh4UqXNDy4ckX4tsKLwMegyg5_Mrajam4Y19xFNrht4coLoLn-zKRCgNbMlu7

You'll see that the arrow is going way over to the left instead of going straight to the component on the right.

What am I missing ? 

commented Jan 22, 2021 by Martin (9,120 points)

I don't think you're missing anything.  It's likely a side-effect of the complex algorithms that plantuml (or more likely, graphviz) use to lay it out and probably is not easy to fix.

You can get the diagram you want by changing:

[R-OC_DET-DET] -[norank,dashed] [R-OC_DET-SAFE_OFF]

into 

[R-OC_DET-SAFE_OFF] -[dashed]--- [R-OC_DET-DET] 

(Swapping the node order, and specifying the rank depth).  But I accept that for automatically generated diagrams this might not be so easy.

view online

commented Jan 25, 2021 by Alroc
Ho sorry I created an answer below to your proposition didn't notice the comment feature :(

1 Answer

0 votes
answered Jan 25, 2021 by Alroc

Hi, thanks for your answer. It definitely works with one dependency (dashed line) but once I add more it starts breaking again.

For example here is a version of the graph without dependencies (dashed line). All components should keep this layout. 

Grap no dependencies

Here is the graph with dependencies 

Graph with dependencies 

Here it is with your solution :

Graph with dependencies without no rank

A few additions, those graphs are generated via a script based on a table so I can't really edit them manually to remove norank at some places but not other. The solution needs to be systematic 
Thank you for your help.

commented Jan 26, 2021 by Martin (9,120 points)

I didn't think of using "left to right direction" as per Th's answer in https://forum.plantuml.net/12915/component-diagram-interface-multiple-components-messes-layout.  That's definitely the best option here as you are trying to draw from left to right (and the default is top to bottom).

...