Straight or right angled lines in Class Diagram's arrows

+12 votes
asked Apr 23, 2013 in Wanted features by anonymous

Hi,

I would like to know if there is a way to represent straight or at least right angled lines in the arrows of the Class Diagram?

Indeed, when there are a dozen of classes with several relationships only, this is no big deal and PlantUML/GraphvizX manage it without a problem.

But as soon as there are complex relationships between a lot of classes, the arrow's lines start to curve, sometimes in a weird way, apparently trying to avoid relation's labels.

Straight or right angled lines would ease the reading of the class diagram in that case.

Thanks a lot for the work already done and those to come!

Douglas DAVID

2 Answers

0 votes
answered Jun 7, 2013 by Fuhrmanator (1,700 points)

I found that if you don't have multiplicity on the ends, PlantUML will stick with straight lines (at least with simple diagrams):

@startuml
Driver - Car : drives >
Car o-- Wheel : has > 
@enduml
 
However, as soon as you add multiplicities, the curved lines are made on the horizontal associations:
 
@startuml
Driver "1" - "1" Car : drives >
Car "1" o-- "4" Wheel : has > 
@enduml
+1 vote
answered Mar 5, 2018 by Anthony-Gaudino (5,720 points)

PlantUML has the skinparam linetype

You can try using skinparam linetype ortho or skinparam linetype polyline

commented Mar 8, 2021 by slyoldbear (100 points)

Hi Anthony,

8 years after my inital question, I’ve seen your answer, and skinparam linetype ortho works like a charm!

Thanks a lot and have a good day :D

Douglas DAVID

commented Sep 15, 2021 by Lucasd
What a cool story
...