2

I am not sure about how to sort components in PlantUML.
From this code:

@startuml
package "TEMP" {
    component [A 1] as A1
    component [A 2] as A2
    component [A 3] as A3
    component [A 4] as A4
    component [A 5] as A5
    component [A 6] as A6

    A1 -[hidden]- A4
    A2 -[hidden]- A5
    A3 -[hidden]- A6
}
@enduml

I get:

A3 A2 A1
A6 A5 A4

If I flip A3, A2 and A1 only, I get:

A1 A2 A3
A4 A5 A6

i.e., also A6, A5 and A4 are flipped.

Is this normal behavior?
Is PlantUML normal behavior to flip the order of the components, so that I have to invert them?

Below, I use the -[hidden]- token to group the objects as I want. Is this the correct approach?

Pietro
  • 12,086
  • 26
  • 100
  • 193
  • Possible duplicate of [PlantUml define relative position of components](https://stackoverflow.com/questions/45103284/plantuml-define-relative-position-of-components) – Peter Uhnak Nov 25 '18 at 17:40
  • See also https://stackoverflow.com/questions/48712801/how-to-correct-plantuml-line-path?answertab=votes#tab-top for more layouting tricks. – Peter Uhnak Nov 25 '18 at 17:40

1 Answers1

0

Well, just leave it as

package "TEMP" {
    component [A 1] as A1
    component [A 2] as A2
    component [A 3] as A3
    component [A 4] as A4
    component [A 5] as A5
    component [A 6] as A6
}

or specify relative positions for all

package "TEMP" {
    component [A 1] as A1
    component [A 2] as A2
    component [A 3] as A3
    component [A 4] as A4
    component [A 5] as A5
    component [A 6] as A6

    A1 -[hidden]> A2
    A2 -[hidden]> A3

    A1 -[hidden]-> A4
    A2 -[hidden]-> A5
    A3 -[hidden]-> A6
}

Both generate the same

image

enter image description here

Paul Verest
  • 60,022
  • 51
  • 208
  • 332