-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to hide unused default tags in the legend #157
Comments
Can you add a sample? You should only see legend of used elements (If you use only tagged elements then the legend displays the untagged element too). E.g. if you use no person you should see no person.
depending on the diagram type different
If you know that you have only "tagged container" and "tagged persons" you could define combined tags
|
@0n3d3r3r I think I found an automatic hide implementation, can you please check #158
Thank you and best regards |
Hi @kirchsth! An example of what I was saying, where I'm not using the default stereotype "container" anywhere in the code but it still appears in the legend:
What you mention on your first answer though looks like a good workaround for me in the meantime, because if I add the "SetDefaultLegendEntries" line, it will manually remove the obsolete default elements from the legend, provided I know which ones I'm actually using or not before hand (I'm using the "node" one, but not the "container" one):
If that pull request you opened (#158) can take care of automatically hiding obsolete default elements in the legend, then that would be the fix for this. Thanks! |
@0n3d3r3r: thank you. Each Container..() call uses internal the "container" stereotype and therefore it's correct that it is displayed based on the the current implementation (I thought your diagrams have an additional e.g. "person" legend entry). With then MR #158 the obsolete container entry is it removed too (you could use my branch in the meantime). BR Helmut
|
@0n3d3r3r: with #160 the realtion styles supports dashed lines too
|
Great! I can use that in the meantime. Also, thanks for noticing my replication line style workaround and referencing the corresponding pull request. I'm sure it's going to be useful to depict async or non-transactional flows at the very least. I hope both features are able to make the cut for the PlantUML 2021.8 stdlib release ;) Best regards. |
@Potherca : I think it's time for a new release (as soon we have it we could merge it into PlantUML stdlib too) |
#157 Legend shows only diagram "style" relevant legend entries
Fixed in #158 |
When you create custom element tags they start appearing in the legend provided you use SHOW_LEGEND() in the last line of the diagram, which is very useful.
However, sometimes we may be only using these custom element tags (e.g.: "fallback") and none of the default ones (e.g.: "system", "container", "external_container", etc.), but they would keep showing up in the legend even if not used at all.
One way to correct that would be if the SHOW_LEGEND procedure had an additional parameter to instruct it to hide all default tags that are not being used. Something like this, perhaps:
SHOW_LEGEND($hideStereotype="true", $hideUnusedDefaultTag="true")
If it's to complex to determine which default elements are not being used, the other way to implement this would be to have a procedure like the following to cancel individual default elements in the legend ahead of the SHOW_LEGEND call:
HideInLegend($DefaultTagToHide)
That would be a little more manual and prone to involuntary errors, but better than having to code the legend table yourself every time you create a diagram with custom elements.
A third alternative is to create a procedure similar to UpdateElementStyle that changes the name of the default element instead of its style, so you can treat a default stereotype like it's a new custom element:
UpdateElementName($elementName, $newElementName)
This is probably the hardest to implement, but would also render a consistent legend table. Usage example:
UpdateElementName(container, $newElementName="main_container")
There may be other ways to achieve this, but I think it's worth to give it a try and make it at least manageable, since those default elements displayed there in the legend create noise or confusion for the audience if they're not actually used across the diagram.
Thanks.
P.S.: Sorry if I'm using incorrect syntax to get the point across; just started learning the inner workings of this by looking at the Include files.
The text was updated successfully, but these errors were encountered: