Please provide a way to define multiple colored edges from one node to another in activity diagrams

+3 votes
asked Apr 22, 2016 in Closed feature request by boshka (2,770 points)
edited Jul 8 by Anthony-Gaudino

Please provide a way to define multiple colored edges from one node to another in activity diagrams.

A single edge would be defined, but with multiple colors, which would generate multiple edges.

Example:

+-----+    RED        +-----+
|     | +-----------> |     |
|  A  |               |  B  |
|     | +-----------> |     |
+-----+    BLUE       +-----+

Suggested syntax:

@startuml
skinparam colorArrowSeparationSpace 14
start
:do a;
-[#red;#blue]->
:do b;
@enduml

The skinparam colorArrowSeparationSpace 14 would be an skinparam to set the distance between the colored arrows.

1 Answer

0 votes
answered Apr 22, 2016 by plantuml (179,660 points)
selected Jul 8 by Anthony-Gaudino
 
Best answer

With last beta: https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

You can use dashed/dotted/bold/hidden like in some other diagrams along with colors, so you can do now:

@startuml
skinparam colorArrowSeparationSpace 3
 start
-[#blue;#yellow;#green]->
 :do a;
 -[#blue;#yellow;#green]->
 if (test) then
 -[#blue,dashed;#yellow;#green]->
 :do b;
 else
 -[#blue,dotted]->
 :do c;
 -[bold]->
 endif
@enduml

@startuml
     skinparam colorArrowSeparationSpace 2
     start
     -[#red;#blue;#green;#orange]-> Red:1\nBlue:\nGreen:3\nYellow:4;
     :do a;
    -[#red;#blue;#green;#orange]-> label;    
     if (test) then
        -[#green;#orange]->
         :do b;
        -[#green;#orange]->        
     else
         -[#red;#blue]->
         :do c;
          -[#red;#blue,dotted]->
     endif
     -[#red;#blue,dashed]->
     while(a)
        -[#red;#blue,dashed]->
        :something}
        -[#red;#blue,dashed]->   
     endwhile
   
    -[#red;#blue,dashed]->

    repeat
         -[#red;#blue,dashed]->
        :something}
        -[#red;#blue,dashed]->
    repeat while(a)is(b)
 @enduml

@startuml
skinparam colorArrowSeparationSpace 2

!define labelTemplate \n<back:backColor><color:white> backColor </color></back> [[anchor{JUMP_TO} ts_id]]
!define tsLabel(backColor,anchor,ts_id) labelTemplate -[#red;#green;#blue]-> 

if(condition)then(yes: tsLabel(red,ANCHOR,TS19) tsLabel(green,ANCHOR,TS20)) -[#red;#green]-> :activity} -[#red;#green]->
else(no tsLabel(blue,ANCHOR,TS21))
-[#blue]-> :activity} -[#blue]->
endif
@enduml

 

@startuml
' skinparam conditionStyle diamond
    skinparam colorArrowSeparationSpace 2
   
    start
    -[#red;#green;#blue;#orange;#maroon]->
    if(Lorem ipsum dolor sit amet)then(yes)
    else(no)
        -[#red;#green;#blue;#orange;#maroon]->
        :consectetur adipiscing elit\n====\nQuisque eu ipsum bibendum,\viverra diam vel, luctus sem;       
        -[#red;#green;#blue;#orange;#maroon]->
    endif

    repeat
   
       
    repeatwhile (Donec vel gravida urna) -[#red;#green;#blue;#orange;#maroon]->

       
        if(a)then(yes)
            partition "ut hendrerit arcu" {           
                :Nulla vitae elit non dui bibendum;
                        -[#red;#green;#blue;#orange;#maroon]->
            }
        else(no)
                -[#red;#green;#blue;#orange;#maroon]->
            partition "tempor at eget nisl\nEtiam dolor ligula, finibus" {
               
            }
        endif
@enduml

@startuml
!definelong someFunc()
                partition dummy {
                    :some function;
                }
            !enddefinelong

             skinparam colorArrowSeparationSpace 1

            start
            
            -[#red;#green;#orange;#blue]->
            if(a?)then(yes)
                -[#red]->
                :activity;
                -[#red]->
                if(c?)then(yes)
                    -[#maroon,dashed]->
                else(no)
                    -[#red]->               
                    if(b?)then(yes)               
                        -[#maroon,dashed]->
                    else(no)
                        -[#blue,dashed;dotted]->
                        :do a;
                        -[#red]->
                        :do b;               
                        -[#red]->
                    endif
                    -[#red;#maroon,dashed]->
                endif
                -[#red;#maroon,dashed]->
                           
            elseif(e?)then(yes)
                -[#green]->
                if(c?)then(yes)
                    -[#maroon,dashed]->
                else(no)
                    -[#green]->       
                if(d?)then(yes)
                    -[#maroon,dashed]->
                else(no)
                    -[#green]->
                    :do something}                                       
                    -[#green]->
                endif
                -[#green;#maroon,dashed]->

                someFunc()

                -[#green;#maroon,dashed]->               
                endif
                -[#green;#maroon,dashed]->
           
            elseif(f?)then(yes)
                -[#orange]->
                :activity}
                -[#orange]->
            else(no)
            -[#blue,dashed;dotted]->
            endif

        stop
@enduml


You can also color single edges:

start
-[#blue]->
:do something;
-[#blue]->
if(a)then(yes)
-[#blue]->
:do a;
-[#blue]->
else(no)
:do b;
endif
-[#blue]->
stop

Is this what you are looking for ?

commented May 19, 2016 by boshka (2,770 points)
Many thanks!
...