How to explain used line types/associations in a diagram

0 votes
asked Mar 8 in Question / help by anoff (230 points)
I am wondering what the best way is to explain what specific associations (--, .., ..|>) mean. Not everyone is fluent in UML and for certain diagrams I want to explicitly state that a certain line type is to be interpreted as dependency, data flow, etc.

Simply putting the association in a legend does not work

Does anyone have a best practice how to achieve this?

2 Answers

+1 vote
answered Mar 8 by Serge Wenger Work (10,980 points)
selected Mar 8 by anoff
Best answer

You can try:

node a
node b
node c
a --> b: data flow
b .. c:interaction 

commented Mar 8 by anoff (230 points)
Works for a small example, but if I have 20 of those elements I would prefer a "legend" style where I only explain this relationship once.

Do you know if there is a way to force puml to render --/.. lines in a legend?
commented Mar 8 by Serge Wenger Work (10,980 points)
You can create an image and after use it on all your diagrams:

node a
node b
node c
a --> b
b .. c
Use image : <img: >
end legend
0 votes
answered Mar 8 by zimchaa (860 points)

Per the other answer and your comment - I don't think there's a way to render the line styles within a specific 'Legend' area, and the C4-PlantUML approach, examples here: shows how colour can be used instead to good effect.

However, I've used a separate part of the diagram within an unspecific 'Legend' folder to allow a faithful redrawing of the elements that I want to reuse in the diagram, including elements of the diagram alongside the linestyles.

component Data Processing System

(Click through to see the code)

I use the stereotype and the skinparams to help reduce the complexity of the actual drawing, the main part of the above could be standardised and included as a link (per the C4-PlantUML approach again) to simplify it even further; it allows for simple changes to the colour and style - there's a small possible bug that I'm going to raise where the linestyle, e.g. dashed or solid doesn't seem to be able to be changed after the usage of the '--' or '..' used to create it in the diagram, but it's a small thing.

commented Mar 8 by anoff (230 points)
Thanks for your examples. I actually dislike the color approach; especially with slight color variations. Several people I worked with over the last years had color blindness to some degree, so relying more on the "UML style" of displaying different meanings by different arrowhead/line styles is my preferred solution.

Plus, we have probably all seen crappy projectors/printers that mess up colors :)
commented Mar 8 by zimchaa (860 points)
Yes, and with printing - it should be able to be printed in b&w without any loss of information - I include colour in the diagrams just to aid with the speed of interpretation - plus I’m a bit red-green colourblind, so that can be annoying (the pastel-ish shades I chose work fine for me)