Is there any way to enforce an order in displaying arrows, components, packages, etc.. ?

0 votes
asked Jan 4, 2016 in Wanted features by anonymous
edited Jan 4, 2016

Hello :)

First of all, thanks for the great work you made and the work in progress :)

I use PlantUML 8015, I have this kind of code:

@startuml

package "pkg1" {
component A
}

[componentB] ----> [componentC] : query
[componentC] ----> [componentB] : response
pkg1---> [componentC] : verify
[componentB] ---> pkg1: send

@enduml

Sometimes, I get pkg1 drawn between the two arrows query/response, sometimes the arrows are drawn sequentially before or after the package.

It doesn't seem to happen in a random fashion (good point) since if I modify the length of arrows, it changes the layout. As a side note, ,I don't understand why my arrow style is not changing for a dotted-like arrows. Maybe, it's an old behaviour ?

I could observe changing the line order doesn't have effect on it.

 

I wish I could find the logic behind in the documentation, and if it's already there, could you please point the right section to me ?

And if there's a bug or if some feature is missing, could you please take it in account and add it to the roadmap ?

Of course, up to now, without any complementary explanation, I'd like to be able to order them simply numbering my arrows or whatever: - e.g. - by 1,2, 3, ...

Best regards

Arnaud

1 Answer

0 votes
answered Jan 4, 2016 by plantuml (295,000 points)

About dotted arrows, the syntax is different between Sequence Diagram and other diagrams (sorry about that, see http://plantuml.com/classes.html#Relations )

For component diagram (and all diagram except sequence diagram), you have to use ..>.

Example:

component pkg1
[componentB] ..> [componentC] : query
[componentC] ..> [componentB] : response
pkg1 ..> [componentC] : verify
[componentB] ..> pkg1: send

About arrows order, the layout is automatically done by GraphViz itself, you cannot control it. The algorithms coded in GraphViz are supposed to give a good result.

There are some tricks about using invisible links to force the layout, but you should really not abuse about this:

http://plantuml.sourceforge.net/qa/?qa=1200/contribute-invisible-links-for-better-graphviz-alinment

http://plantuml.sourceforge.net/qa/?qa=3648/invisible-packages-improve-layout-diagrams-visible-packages

http://plantuml.sourceforge.net/qa/?qa=3188/add-norank-option-on-links

Users are sometimes frustrated about this lack of control. Having no control can sometimes be seen as an advantage, because it prevents you to focus on the layout.

Anyway, if you find example where the layout is really bad, do not hesitate to post it here : we'll see what we could do.

Regards,

commented Jan 4, 2016 by anonymous
Thank you very much for your quick answer :)
Thanks for the tips hidden/norank, I think it won't apply to arrows though :)

My given example was real, I won't say the result is very bad, it is not. But, when two or more arrows are linking the same two "items", I think we can sometimes prefer seeing them drawn sequentially.
Okay, it's just a matter of point of view.

Back to my example, "response" is strongly linked to the "query" and since my complete graph will not  be restricted to the extract I gave, I don't want to let the reader imagine the query is lost or ignored till (s)he sees the second arrow somewhere in the graph.
Especially because, despite of not being a sequence-type or state diagram, the response occurs chronologically just after the query and before other actions. I could use numbering within annotations or indices in labels and the reader can follow that numbering. But it would impose a strict reading and may break the logic.

If you have any idea, please tell me :)

Arnaud
...