-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make legend fill whitespace #134
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
Comments
Hi, thank you for taking the time to report this! Although I like the idea, I am not sure if this is something that can be implemented in this lib, as the placement and rendering is done by PlantUML itself. Something might be possible (with hidden lines for instance) but it will take a lot of trial and error to figuring things out. Do you happen to have any ideas towards implementation yourself? |
Sadly i dont have much experience in PlantUML, so i dont have any insight into how this could be implemented. |
I've played around with this a bit and I don't think there is any way for us to improve upon the current behavior. The only thing that I can think of to slightly improve the diagram is to use The problem is that PlantUML adds the legend in a separate space by itself, at the bottom of the diagram:
There is a post on the PlantUML forum requesting something similar but it doesn't seem to have much attention. You could try upvoting and commenting there to see if this could be implemented on the PlantUML side of things. @JorisvanRoy For now, unless you strongly disagree, I'm in favor of closing this issue, as we can't fix this in C4-PlantUML itself. |
@Potherca, @JorisvanRoy: I found a workaround via note, but I cannot remove the shadow or line of the note (the text in the middle is copied from the dynamic legend definiton)
BR Helmut |
That can be resolved by using |
@Potherca, @JorisvanRoy: It's not 100% perfect but very generic
PS.: the problem is the white small line on the left side of "C" (I think it could be a problem of the Lay_L definition, but I found no workaround) |
…._DOWN(), ..._LEFT(), ..._RIGHT()
Hi @JorisvanRoy, @Potherca |
I like these changes a lot but as they are non-trivial (i.e. moving from the PlantUML |
Hi, My MR supports only 1 legend (I used instead of notes one concrete rectangle with alias "legendArea") BR Helmut PS.: In the meantime https://forum.plantuml.net/9032/legend-unnecessarily-extends-diagram-size?show=13621 contains a better layout (more in the right corner) based on "-[hidden]-->" therefore I plan to add an additional call which creates only the legend (SHOW_FLOATING_LEGEND() == $getLegendArea($hideStereotype)) and the (hidden) relation can be added separately too. |
Hi @Potherca, I think found a better solution, with the new calls "SHOW_FLOATING_LEGEND()" and "SET_FLOATING_DISTANCE()"
It is still not perfect:
BR Helmut |
Would it be possible to use a note without adding a direction/link to an existing element? Or use a separate element (for instance |
the floating area is already a separate rectangle with the name $areaAlias (and no note anymore) !procedure $getLegendArea($areaAlias, $hideStereotype) ' rectangle [ ' generated table ' end of rctangle ] If you use no link then it has no clear position like
BR Helmut PS.: you can have notes without a link too
|
@Potherca, @JorisvanRoy: I think the existing MR #143 is not the best solution, should I add the SHOW_FLOATING_LEGEND() and SET_FLOATING_DISTANCE() calls (maybe with better names)? |
Yeah, I think so. Awesome work on this, by the way! |
…() and Lay_Distance() (instead of SHOW_LEGEND_UP(), ..._DOWN(), ..._LEFT(), ..._RIGHT())
…() and Lay_Distance() (2 - fix https://)
…() and Lay_Distance() (3 - legend is reserved; LEGEND() is new default alias)
@JorisvanRoy: I think I found a solution which works in all scenarios. Can you check it and give me a feedback? You can test it in my extended branch. @Potherca: MR #143 is updated with the final implementation and can be merged. ============== (In combination with SHOW_FLOATING_LEGEND()) a greater distance between an element and the
============== SHOW_FLOATING_LEGEND(?alias, ?hideStereotype) and LEGEND()
Therefore a floating legend can be added via SHOW_FLOATING_LEGEND(), positioned with Lay_Distance() and existing whitespace is reused like below.
@startuml Compact Legend Layout Sample
!include https://raw.githubusercontent.com/kirchsth/C4-PlantUML/extended/C4_Container.puml
Person(a, "Person A")
Container(b, "Container B", "techn")
System(c, "System C")
Container(d, "Container D", "techn")
Container_Ext(e, "Ext. Container E", "techn")
Rel_R(a, b, "calls")
Rel_D(b, c, "uses")
Rel_D(c, d, "uses")
Rel_R(d, e, "updates")
SHOW_FLOATING_LEGEND()
Lay_Distance(LEGEND(), e, 1)
@enduml |
@Potherca I think you can add it to release 2.3. too |
#134: Legend fill whitespace with SHOW_FLOATING_LEGEND() and Lay_Distance()
Hi,
Whenever I create a diagram with this plugin I like to implement the Legend with my diagrams. Whenever I add the legend to the diagrams it is put at the bottom right of the picture like this.

If it would be possible then it would be awesome to have the legend fill the remaining whitespace instead of creating more whitespace. Something like this:

The text was updated successfully, but these errors were encountered: