Nikhil
Nikhil

Reputation: 1059

avoid overlapping arrows in plantuml class diagrams

I am using plantuml for creating the class diagrams along with arrows and messages on the arrows. It works perfect untill the diagram is huge. In large diagrams where there are multiple arrows and multiple classes, the arrows gets overlapped with each other hiding/overlapping the arrows and messages on it. Is there any property or way to avoid these overlapping? It will be OK even if the diagram size grows. I read about -

overlap = false; 
splines = true;

properties here, but I am not sure how to use it with PlantUML or SVG file.

Note : I am creating a SVG file from plantuml using java.

Upvotes: 30

Views: 5673

Answers (1)

Potherca
Potherca

Reputation: 14630

This is a common problem and because of its complexity, there isn't a single individual fix for it.

There are a few strategies to deal with this problem, that can be combined in different ways to create different results. In no particular order:

  • Adding [hidden] helper lines

    For instance A -[hidden]- B.
  • Changing arrows orientation

    Use arrow direction by adding left, right, up or down keywords inside the arrow (or l, r, u, or d), for instance A -left-> B.
  • Using different arrow type, color, or thickness

    To create a clearer distinction between different lines
  • Using left to right direction

  • Using sub-diagrams

    To split one large diagram into separate entities
  • Using the together keyword

    To group elements together (or rectangle, etc. if you want a visible boundary)
  • Trying a different layout engine.

    The default is GraphViz, but you can also try Elk, Smetana, and VizJs.

And finally:

  • Just accept the overlap

    Sometime, we focus too hard on details (such as overlapping lines) that are not so important once we zoom out again. So sometimes, overlap is acceptable and not worth the effort of remedying.

Upvotes: 3

Related Questions