I'm creating a diagram with different types of arrows (line, dashed, dotted, etc.). But instead of adding a label to each arrow I would like to create a legend where a replica of each arrow type is displayed alongside its meaning.
Is there a way to tell PlantUML to simply draw a small segment of a specific arrow type?
Is there a way to tell PlantUML to simply draw a small segment of a specific arrow type?
Generally speaking, no, especially not in a legend.
However, I can think of a way (it's somewhat complicated). A legend will let you include images, and you can use PlantUML to generate each arrow image.
Here's one example to get a regular arrow (I'm making the classes small and hiding them with some magic):
skinparam style strictuml
scale 0.5
hide empty members
skinparam Class {
BorderColor transparent
BackgroundColor transparent
FontColor transparent
}
class " " as A
class " " as B
A -> B
If you render that, you get a URL of https://www.plantuml.com/plantuml/png/ROpB2i9034Nt-OhWNd7ZLkWK_8yu4tJeF4gIBahntmqAWcWk10udkJhbDfDGHRMri6_9qPPQG2Cv7mydkEV4o7Ms5IlNAuk2Vjx6Gggu0Vg4BebbxAKBcb1JF-5cRqTnkabVMlhlBxtPhtb0VFNlFAGuV6E00VTd34y0 which looks like
Next, you plug that URL into an <img:>
tag in a legend of another diagram:
@startuml test
legend
| <img:https://www.plantuml.com/plantuml/png/ROpB2i9034Nt-OhWNd7ZLkWK_8yu4tJeF4gIBahntmqAWcWk10udkJhbDfDGHRMri6_9qPPQG2Cv7mydkEV4o7Ms5IlNAuk2Vjx6Gggu0Vg4BebbxAKBcb1JF-5cRqTnkabVMlhlBxtPhtb0VFNlFAGuV6E00VTd34y0> | regular arrow |
end legend
@enduml
The result is