Monday, 20 November 2023

Customizing Arrow Direction in PlantUML Component Diagrams: Up, Down, Left, and Right

Change the arrow direction to horizontal, vertical

Use two dashes (--) for vertical direction and one dash (-) for horizontal direction.

 

horizontalVertical.txt

@startuml

[Component1] --> [Component2] : Vertical
[Component1] -> [Component3] : Horizontal

@enduml

Above snippet generate below diagram.


 


You can change the direction by reversing the links <--, <-

 

changeDirection.txt

@startuml

[Component1] <-- [Component2] : Vertical
[Component1] <- [Component3] : Horizontal

@enduml

 

Above snippet generate below diagram.



  

Use keywords left, right, up  and down to get more control on the direction

 

arrowDirectionCustomization.txt

@startuml

[Component1] -left-> [Component2] : left
[Component1] -right-> [Component3] : right
[Component1] -up-> [Component4] : up
[Component1] -down-> [Component5] : down

@enduml

 

Above snippet generate below diagram.

 

 


By default the orientation is from top to bottom, you can customize it using below command.

left to right direction

 

let’s apply above command to the previous image.

 

leftToRightDirection.txt

@startuml

left to right direction

[Component1] -left-> [Component2] : left
[Component1] -right-> [Component3] : right
[Component1] -up-> [Component4] : up
[Component1] -down-> [Component5] : down

@enduml

Above snippet generate below diagram.




Previous                                                    Next                                                    Home

No comments:

Post a Comment