How to force vertical arrangement of packages?

0 votes
asked Dec 29, 2018 in Question / help by Behrang

Hi,

This specification:

@startuml

hide circle
hide members

package " Some Foo Package " as P1 {
    class "Foo Core" as FooCore
    class "Foo Shell" as FooShell
    class "Foo Config" as FooConfig
}

package " Some Bar Package " as P2 {
    class "Bar Core" as BarCore
    class "Bar Shell" as BarShell
    class "Bar Config" as BarConfig
}

package " www.example.local config " as P3 {
    class " Config 1 " as Config11
    class " Config 2 " as Config12
}

package " www.example2.local config " as P4 {
    class " Config 1 " as Config21
    class " Config 2 " as Config22
}

FooShell  --> BarCore: creates
BarShell --> Config11: creates
BarShell --> Config21: creates

@enduml

is rendered into:

However if I change the associations slightly, it is no longer rendered in three layers. In other words,

@startuml

hide circle
hide members

package " Some Foo Package " as P1 {
    class "Foo Core" as FooCore
    class "Foo Shell" as FooShell
    class "Foo Config" as FooConfig
}

package " Some Bar Package " as P2 {
    class "Bar Core" as BarCore
    class "Bar Shell" as BarShell
    class "Bar Config" as BarConfig
}

package " www.example.local config " as P3 {
    class " Config 1 " as Config11
    class " Config 2 " as Config12
}

package " www.example2.local config " as P4 {
    class " Config 1 " as Config21
    class " Config 2 " as Config22
}

FooShell  --> BarCore: creates
BarShell --> Config11: creates
BarShell --> Config21: creates

@enduml

is rendered to:

How can I enforce a layout in which "Some Foo Package" is on top of "Some Bar Package", and "Some Bar Package" is on top of the other two packages?

Also how can I enforce the classes in Some Foo Package remain on the same line?

FooConfig-[hidden]-FooShell
FooShell-[hidden]-FooCore

didn't help:

Thanks in advance.

commented Dec 30, 2018 by albert (3,520 points)
I must have overlooked something but I don't see any difference between the 2 code parts.
Did you try them on the plantuml webserver (http://www.plantuml.com/plantuml/uml) as well?

1 Answer

0 votes
answered Dec 29, 2018 by anonymous

Looks like connecting the nodes using:

X-right[hidden]-Y
X-left[hidden]-Z
X-up[hidden]-Z

X-down[hidden]-Z

can help:

@startuml

hide circle
hide members

package " Some Foo Package " as P1 {
    class "Foo Core" as FooCore
    class "Foo Shell" as FooShell
    class "Foo Config" as FooConfig
}

FooConfig-right[hidden]-FooShell
FooShell-right[hidden]-FooCore

package " Some Bar Package " as P2 {
    class "Bar Core" as BarCore
    class "Bar Shell" as BarShell
    class "Bar Config" as BarConfig
}

package " www.example.local config " as P3 {
    class " Config 1 " as Config11
    class " Config 2 " as Config12
}

package " www.example2.local config " as P4 {
    class " Config 1 " as Config21
    class " Config 2 " as Config22
}

P1 --> BarCore: creates
P2 --> Config11: creates
P2 --> Config21: creates

@enduml

...