Activity Diagram with swimlanes and fork: how to disable horizontal shift

0 votes
asked Sep 11, 2025 in Question / help by smfpu (120 points)

Hi there,

I'm having trouble with the width of swimlanes and the horizontal positioning / vertical alignment of boxes therein. The activities should be vertically aligned and no space should be wasted. How could this be achieved?

Thanks for any hint.

@startuml

|P1|
|P2|
|P3|
|P4|
|P5|

|P1|
  start
  :Do1;
|P2|
  :Do2-is-something-really-long;
|P5|
  if (Cond1?) then (ok)
    |P2|
      :Do3-is-longer;
    |P1|
      :Do4;
      floating note right
        Comm1
      end note
    |P5|
      :Do5-is-longer-too;
    |P1|
      :Do6;
      :Do7;
    fork
    |P2|
      :Do8-is-something;
      :Do9-is-another-thing;
    fork again
    |P3|
      :Do10;
      :Do11;
    fork again
    |P5|
      :Do12-leads-to-more-and-more-width;
    end fork
    |P4|
      :Do13;
    |P5|
      :Do14;
  else (not ok)
  stop
  endif
stop

@enduml

commented Sep 11, 2025 by smfpu (120 points)

...and playing around, it seems that changing an activity in P5-lane changes the width and formatting of activities in P2-lane sad

Having this as base which is ok:

@startuml

' configuration

!define myTask(x) #PaleGreen:x;<<task>>

|P1|
|P2|
|P3|
|P4|
|P5|

|P1|
  start
  :Anfrage zu Vorgang;
|P2|
  myTask(Anfrage Vorgang-Voraussetzungen)
|P5|
  if (Vorgang-Voraussetzungen erfüllt?) then (ok)
    |P2|
      myTask(Eintragung Titel und Start)
    |P1|
      myTask(Zustimmung)
      floating note right
        automatisch
        nach
        Zeitablauf
      end note
    |P5|
      :Eintragung Vorgang in DB;
    |P1|
      :Bearbeitung Vorgang;
      myTask(Abgabe Vorgang durch Upload)
    |P2|
    fork
      :Bewertung Vorgang;
      myTask(Eintragung Ergebnis)
    fork again
    |P3|
      :Bewertung Vorgang;
      myTask(Eintragung Ergebnis)
    fork again
    |P5|
      :Prüfung besonderer Kriterien;
    |P4|
    end fork
      :Zusammenführung;
      myTask(Eintragung Ergebnis)
    |P5|
      :Eintragung Ergebnis in DB;
      stop
  else (nicht erfüllt)
'    myTask(Vorgang schließen)
    stop
  endif

@enduml

Then adding the activity / removing the comment-mark like

myTask(Vorgang schließen)

in P5 has high (and unwanted) impact on P2.

Is there any way to manually set the position of the boxes? I would rather give absolute coordinates than having untouched lanes changed...

commented Sep 13, 2025 by smfpu (120 points)
added guthub issue with pictures and detailled width problem description:

https://github.com/plantuml/plantuml/issues/2335
commented Sep 13, 2025 by smfpu (120 points)
first step without fork looks very nice:

https://editor.plantuml.com/uml/lLIzKkGm3Evv2jrSmQQuWhzcb-60WQ6WsHcuAvXjd8ti-71aHhRdE6RVXHUXsnSxXKt0oS4S5LKKMTBtwPDi083Z41N7rBYjBVc3RLXwqjOaLj5wsZY_LAWj8JH_hbMudTmNy7Mk75um8atlPuU7KTn7HvlWrNndrHcxlR7N6_kzSR0QHGCy4-diwGbfLWRX8S5FpqQHcGsBGi-cZ-p2libNfH0mFYGoICKhu2RDQfZqiGiQHIy8MQ-Vd8lV2uWr4an-gQBB7A1d3CujHQ4W1U3QHdIGg8AhjfiyS-UDp9iKecqQoIooG-syY2_Lo4S4jgQEsIc0Ij4t4X6MzS1FQkIuGHjLwLJIcHk5N5iuetQGKvjcxNGwWIKuEvszrypq51MNWfMbpFvjzgGqgdoP4rI9bpNyk9Dcgv72sozAUBuT0lr6_WzCHl-S3PPaGp6i2CeeIndatkeJG8OYptdzfDlq4eEd2XaPBbcsXorIhlH-9aSxkh4aiaAgQP1aQsjE7oVx7h4tWiVZRw-gl-j-qGM42Q6bJ80Ek1-rBAgpk7xiR-Eu15LMRvw3Ox7bBVeB

adding forks result in too wide P2 and P5:

https://editor.plantuml.com/uml/jLIzJXmn4EvvYebIS5jG4A2vGmHGK8eq9uMaG3JUsx7NmJj6OriXwDubBq9tBvRPt3fubn14aMfdn_FDzysF3G1m6gBYc3gtioD_i0ihJzgQn2fQJrldcmQr9OJknwKADxEx2jukbSEFZ4ZpkyNnSHJtoSasUBtSNm_6ksmSPECm6qVhIJJ0Ro63FJyZpSeWt2VuwjaeCejnKiXgSkGGjYTVbKB0U9_885MFX5kOrJ3BiTSqYRucPBrvS2w-ho2sI33xfge1EM8l55nOYY914i2bZUWWKGEV-sfAvFvVa5SfHDjrWgoAG-syD5-oaOy8R4qRYrC0bQBl92Aisf6VrCHnXJQgsgca2pUAk3vn8Useb3OloXdw19RWm_dYkMBcvwYu5gu2idXQx5bjLFrdJj0aNhNmvLQARPxfiFPyC-RvZlm2Iw7-WWtMP4CrIWZAA4i5uS7w_tECExpapOFkqJK6JmqoCdnYMHssI6MR3nzX_TYc_P3rKLs791lRSdgzr7zCFWTFHzzVKtyx_A8B23D2AxTiTqASnonBwYnkVkQRE4r1ZTNRf-1KR7c7VW40

adding activity in P5 widens P2 and crumbles alignment:

https://editor.plantuml.com/uml/jLGxRjmm4ErzYWbIP5MaS6mtkuP_Y972pG9sKXZRKAiXnPWQ6aCI_c3luekusujbv9Mob1BRI95Am-5xCsy-8W30IOYAOshSpewSu1CiFMbh4gjeFMsS7ohKbX2QXoiLRYRt1NoSAuVV696czxF3moZkewCDU3NVNNN6bzxOwutztZXOZT00Bq8wUtfAcfL1U4pmmxDHP6R3eD2hwP4TxBDyLGe1usCYWrHi4sveLiEanoveX5uGibu_EnUF2uWr4an-gg9Z3h9d2iujHP4W0U3AHdIGg8BBjfgSkViNvdKAqJQDC8liKZilpPTev2C2MrF7x1P0fUWRGOHbFV2J6ZckqKPLEfLqvaOHrmREf1taqgPPELsVm19yFPkzLipq31MNaYkZpFuizhGqglmz9wWIBsluVYl5LgzqM7k-6UQvGtudIwR-d0sMP4Cn20ZAA4jPmhtL_yynxF2Sry-wPPSOF5N8o731iZfiaV8sxszfxTZ6_P3rKKs391jRS_ftgMzClWUFHz_-flwsEw8B21D2IzkONTv-ohAZpkBw2JD87e4ggpSlmOdOyWpz0W00

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...