Help to create Activity Diagram

0 votes
asked Oct 17, 2022 in Question / help by J.B.

Hello!

I try to create an Activity Diagram, which looks like this:

But what I get is something like this:

I used this code to create the graph:

@startuml

title Cycle

(*) --> "Create"

if "Creation succesful?" then

  -->[Yes] "Start"

  --> "Stop"

  --> "Start"

  --> "Delete"

  --> (*)

else

  -->[No] "Create"

endif

@enduml

How can I get the last arrow from "Stop"  to "Delete" instead from "Start"? 
Is there a better way to create such a graph? The check "Creation successful" and the arrows from and to "Create" doesn't look beautiful. frown

Thanks for your help!

Best regards,

J.B.

1 Answer

0 votes
answered Oct 17, 2022 by The-Lu (64,760 points)

Hello J.R.,

Here is a proposal, adding at the end your request:

@startuml

title Cycle

(*) --> "Create"
if "Creation succesful?" then
  -->[Yes] "Start"
  --> "Stop"
  --> "Start"
else
  -l->[No] "Create"
endif

"Stop" --> "Delete"
  --> (*)
@enduml

Enjoy,
Regards,
Th.

commented Oct 18, 2022 by J.B.

Super! Thank you!

One last question: Is it possible to add a label to a connection arrow?
There is an example in the docu, but the syntax does not fit! surprise

@startuml
:foo1;
-> You can put text on arrows;
if (test) then
  -[#blue]->
  :foo2;
  -[#green,dashed]-> The text can
  also be on several lines
  and **very** long...;
  :foo3;
else
  -[#black,dotted]->
  :foo4;
endif
-[#gray,bold]->
:foo5;
@enduml

@startuml

title Cycle

(*) --> "Create"
if "Creation succesful?" then
  -->[Yes] "Start"
  --> "Stop"
  --> "Start"
else
  -l->[No] "Create"
endif

"Stop" --> "Comment"; :"Delete";
  --> (*)
@enduml



Best regards,

J.B.

commented Oct 18, 2022 by The-Lu (64,760 points)

Hello J.B.,

For that use use '[' and ']' as:

@startuml

title Cycle

(*) --> "Create"
if "Creation succesful?" then
  -->[Yes] "Start"
  --> "Stop"
  --> "Start"
else
  -l->[No] "Create"
endif

"Stop" -->[Comment\nor label to a connection arrow] "Delete"
  --> (*)
@enduml


To see your expected result:


And here you use old legacy Activity diagram, then see '§Label on arrows' on the doc. page:

Regards.

...