plantuml component diagram - layout control

Federico Destefanis picture Federico Destefanis · Apr 20, 2018 · Viewed 10.3k times · Source

I'm trying to build an "hardware architecture" graph using plantuml component diagrams and I'm struggling with the layout.

My graph is growing to be pretty complex and I'm noticing plantuml keeps on adding frames left to right, making the graph grow horizontally.

From this code for example

@startuml

' -----------------------------------------------------
skinparam defaultTextAlignment center
' -----------------------------------------------------
top to bottom direction


frame Pippo as pippo {

frame "Pippo Deploy" {
node "xxx1\nfoo" <<windows 7>>
}

frame "Pippo Core" {

node "===xxx2\nbar" <<amiga>> 
node "===xxx2\nbar" <<amiga>>
node "===xxx3\nbar" <<amiga>>
node "===xxx4\nbar" <<amiga>>
node "===xxx5\nbar" <<amiga>>
node "===xxx6\nbar" <<amiga>>
node "===xxx7\nbar" <<amiga>>

}

frame "Pippo Additional Servers" {

node "===xxx8\nfoo" <<windows 7>> 
node "===xxx9\nfoo" <<windows 7>>
node "===xxx10\nfoo" <<windows 7>>
node "===xxx11\nfoo" <<windows 7>>
node "===xxx12\nfoo" <<windows 7>>
node "===xxx13\nbar" <<amiga>>
}

frame "Pippo other"  {
node "===xxx14\nfoo" <<windows server 2003>>
}

}

frame "Pluto" as pluto {

frame "Pluto 1" {

node "===xxx15\nfoo" <<windows server 2012>>
node "===xxx16\nfoo" <<windows 7>>
node "===xxx17\nbar" <<amiga>>

}

frame "Pluto 2" {

node "===xxx18\nfoo" <<windows server 2003>>
node "===xxx19\nfoo" <<windows 7>>
node "===xxx20\nfoo" <<windows 7>>
}


}

pippo --[hidden]> pluto


@enduml

I get this graphenter image description here

I would like instead to have the frame "Pluto" under the frame "Pippo"

See that I already used an hidden link and top to bottom direction, trying to force that kind of layout, but with no results.

Answer

Florenz Kley picture Florenz Kley · Jul 26, 2018

how about this:

replacing the top to bottom direction with left to right direction and commenting the pippo --[hidden]> pluto gets me this:

enter image description here

full code:

@startuml

' -----------------------------------------------------
skinparam defaultTextAlignment center
' -----------------------------------------------------
'top to bottom direction
left to right direction

frame Pippo as pippo {

frame "Pippo Deploy" {
node "xxx1\nfoo" <<windows 7>>
}

frame "Pippo Core" {

node "===xxx2\nbar" <<amiga>> 
node "===xxx2\nbar" <<amiga>>
node "===xxx3\nbar" <<amiga>>
node "===xxx4\nbar" <<amiga>>
node "===xxx5\nbar" <<amiga>>
node "===xxx6\nbar" <<amiga>>
node "===xxx7\nbar" <<amiga>>

}

frame "Pippo Additional Servers" {

node "===xxx8\nfoo" <<windows 7>> 
node "===xxx9\nfoo" <<windows 7>>
node "===xxx10\nfoo" <<windows 7>>
node "===xxx11\nfoo" <<windows 7>>
node "===xxx12\nfoo" <<windows 7>>
node "===xxx13\nbar" <<amiga>>
}

frame "Pippo other"  {
node "===xxx14\nfoo" <<windows server 2003>>
}

}

frame "Pluto" as pluto {

frame "Pluto 1" {

node "===xxx15\nfoo" <<windows server 2012>>
node "===xxx16\nfoo" <<windows 7>>
node "===xxx17\nbar" <<amiga>>

}

frame "Pluto 2" {

node "===xxx18\nfoo" <<windows server 2003>>
node "===xxx19\nfoo" <<windows 7>>
node "===xxx20\nfoo" <<windows 7>>
}


}

'pippo --[hidden]> pluto


@enduml