Is there a way modify an activity diagram's rendering?

0 votes
asked Jul 12, 2023 in Question / help by AdrianH (140 points)

Let's say I have the following code:

@startuml
start
if (Condition) then (yes)
  :Process A;
else (no)
  :Process B;
endif
:Process C;
stop
@enduml

And I get the following output:

Activity Diagram

But I want it to look more like a flow diagram.  This would require the following changes:

  1. Boxes should be with square, not rounded corners.
  2. Why is there an intermediary diamond where yes/no paths meet up?  Would like to get rid of that.
  3. Sometimes it would be nice to colorize certain objects for grouping/emphasis purposes.  Is that possible?
commented Jul 17, 2023 by AdrianH (140 points)
Is there no information regarding this?
commented Jul 17, 2023 by The-Lu (76,960 points)

It is now done... Enjoy

3 Answers

0 votes
answered Jul 17, 2023 by The-Lu (76,960 points)

Hi A., and all,

For:

  1. Boxes should be with square, not rounded corners.

You can use style as:

@startuml
<style>
activityDiagram {
  activity {
    RoundCorner 0
  }
}
</style>
start
if (Condition) then (yes)
  :Process A;
else (no)
  :Process B;
endif
:Process C;
stop
@enduml

Enjoy,
Regards,
Th.

0 votes
answered Jul 17, 2023 by The-Lu (76,960 points)

Hi A., and all,

For:

2. Why is there an intermediary diamond where yes/no paths meet up?  Would like to get rid of that.

You can use `skinparam ConditionEndStyle hline` as:

@startuml
skinparam ConditionEndStyle hline
<style>
activityDiagram {
  activity {
    RoundCorner 0
  }
}
</style>
start
if (Condition) then (yes)
  :Process A;
else (no)
  :Process B;
endif
:Process C;
stop
@enduml

Enjoy,
Regards,
Th.

0 votes
answered Jul 17, 2023 by The-Lu (76,960 points)

Hi A., and all,

For:

3. Sometimes it would be nice to colorize certain objects for grouping/emphasis purposes.  Is that possible?

For that you can use color and grouping/partition as:

@startuml
skinparam ConditionEndStyle hline
<style>
activityDiagram {
  activity {
    RoundCorner 0
  }
}
</style>
start
if (Condition) then (yes)
  :Process A;
else (no)
  partition #lightGreen "Colorize certain objects\nfor grouping/emphasis" {
  #pink:Process B;
  }
endif
:Process C;
stop
@enduml

See also doc. here:


Enjoy,
Regards,
Th.

commented Aug 7, 2023 by AdrianH (140 points)
Thanks everyone for all the responses.  Very helpful.

Cheers,

A
commented Aug 7, 2023 by AdrianH (140 points)

And by everyone, I meant The-Lu. laugh

...