Layout of grouping component

+3 votes
asked Feb 21, 2014 in Bug by rmric (2,140 points)
edited Aug 26, 2014 by rmric

Hi,

I'm struggling with component diagram layout, and I think I narrowed it down to a simple test case.

@startuml
component AA_ok {
}
[BB_ok]
AA_ok -r-> BB_ok

component AA {
  [CC]
}
[BB]
AA -r-> BB
@enduml

Rendu du bug de placement

For any element (component, package, node, etc.), as soon as it is grouping something:
-right-> is misinterpreted as down,
-left-> is misinterpreted as up.
and all the relations are slanted instead of vertical/horizontal.

It happens for any arrow type, and using either notation -> or -r->.

The -up-> and -down-> are working alright (albeit slanted too).

PlantUML version is 7992.
Version 8003 still affected.

 

There's another issue when the grouped elements are staged on more than one line. In that case, the "right" arrow comes back on the right (but slanted) and "down" is now moved on the right. It happens for either the grouping box or one of the element inside (AA or BB1 in below example).

@startuml
package AA_ok {
}
component up_ok
component down_ok
component right_ok
component left_ok
AA_ok -u-> up_ok
AA_ok -d-> down_ok
AA_ok -r-> right_ok
AA_ok -l-> left_ok

package AA {
  component BB1
  component BB2
  component BB_next_line
}
component up
component down
component right
component left
AA -u-> up
AA -d-> down
AA -r-> right
AA -l-> left
@enduml

Rendering of placement bug with grouping

 

BTW, it looks like class diagrams suffer both problems:

@startuml
package AA_ok {
}
class BB_ok
AA_ok -r-> BB_ok

package AA {
  class CC
}
class BB
AA -r-> BB
@enduml

Rendering of placement bug in class diagram

State diagrams are fine smiley

Best Regards

 

EDIT: added new case when grouped elements are on more than one line
EDIT: added rendered diagrams

2 Answers

0 votes
answered Aug 26, 2014 by plantuml (295,760 points)
0 votes
answered Sep 29, 2014 by rmric (2,140 points)

Thanks for the partial fix  !pragma horizontalLineBetweenDifferentPackageAllowed.

However, there's still a bug with elements placed below another one (v8008):

@startuml
!pragma horizontalLineBetweenDifferentPackageAllowed
package AA_ok {
}
component up_ok
component down_ok
component right_ok
component left_ok
AA_ok -u-> up_ok
AA_ok -d-> down_ok
AA_ok -r-> right_ok
AA_ok -l-> left_ok

package AA {
  component BB1
  component BB2
  component BB_next_line
}
component up
component down
component right
component left
AA -u-> up
AA -d-> down
AA -r-> right
AA -l-> left
@enduml

Rendering of component positionning bug

In the above example, the "down" component is wrongly placed on the right.
On a minor note, the "up" is not centered relative to the AA package, like with AA_ok.

Thanks in advance for your help.

commented Jun 1, 2021 by The-Lu (73,540 points)

Hello R.,

To complete an old question...
With new version from ~V1.2021.5, and new layout elk:

!pragma layout elk

You can observe this result:

With layout elk
(new fashion)

See all result on this page:

Regards,
Th.

...