plantuml / plantuml

Generate diagrams from textual description
https://plantuml.com
Other
9.73k stars 881 forks source link

Max size for notes, similar to #35 #104

Closed noamtamim closed 1 year ago

noamtamim commented 6 years ago

skinparam maxMessageSize doesn't affect notes. I can see why that may be -- people may want more control over note formatting. Please add another param, maxNoteSize that would do the same for notes.

And I see that in #35 you wonder if this name is good. I'd say wrapMessageWidth (if measured in pixels) and/or wrapMessageCols (if measured in characters) are better, since this param doesn't limit the size, it just inserts line breaks.

Sidetalker commented 6 years ago

I knew this project wasn't dead, good, thanks.

arnaudroques commented 6 years ago

Not dead, but clearly overloaded :-)

Anyway, thanks for the suggested parameter name. With last beta http://beta.plantuml.net/plantuml.jar you can now have:

@startuml
skinparam wrapWidth 100
component component1 [
   this is a very long component description
]
note left
   this is a very long note that show be wrapped
end note
@enduml

and also

@startuml
skinparam wrapMessageWidth 100
A->B:very long long long message name

@enduml

Note sure if we should have separate settings for notes, components... So I let you guys talk about this (no time to think right now :-) )

drboa commented 5 years ago

Wrap width doesn't appear to be working on notes or on components...

arnaudroques commented 5 years ago

Could you give a non-working example ? The following one is working for us: http://www.plantuml.com/plantuml/uml/TOv12W8n34NtESK_mimDvXOkn4MSHbjiaz961szlwK9NGXOFyZwyhJitVvPC_P6qSkE2et4zfU0HwxBGRgMQYZg-jE9C03ocZd6CbxGtikdzvo18trkgdapfGceko7BpVyCfU6H7ZtRWAZEZIY3HCB-q3Hgb7m00

drboa commented 5 years ago

I don't know if wrapWidth is meant to work on sequence diagrams (it would be extremely useful if it did...) but it doesn't do anything at the moment...

http://www.plantuml.com/plantuml/png/XOwn2i90343tV4KsfuABYqEfVeFGEVP2x-WrgRdKujzxAheA8JmUF9AkE9clSuOo9Ld8QCRDQEbJy8Y7FS0ffu6RzgpN8qREMQ5YqxHl_rKWweoMnkXmYQbW7S8xs-FFoYeZlcA0_dSsA1VPEMvg4wfWuTlACZ26HAFHN80bVAgkKlt-2G00

arnaudroques commented 5 years ago

Thanks for the feedback. It should be fixed in last beta http://beta.plantuml.net/plantuml.jar

drboa commented 5 years ago

I've noticed with the beta that wrapWidth is not being applied to text in legends:

http://www.plantuml.com/plantuml/png/jOv12W8n303lUKK-87Znua5Mt-07wZQqmRGfQTR5txjb_O488Kno66Rg7ioN8j2VN5kmK72rq5QEdl5q111AL2EwDhXdxhXDm1VP-_SbMXD-_P7wRDoSjSAuzpV0JHzukE1LU2OyOoOH1QZgXCOf-t-YXdzax31jj1Jv0000

arnaudroques commented 5 years ago

Yes, but maybe we should use a separate setting for legend: general wrapWidth (for message, notes...) should be different that wrapWidth for legend that can be as wide as the diagram itself. Any though ?

zimchaa commented 5 years ago

I'm not sure if it should, but wrapWidth doesn't seem to be working in Activity (Beta) for notes:

@startuml
skinparam wrapWidth 150

title: Note wrapWidth Test

start 
    :This is a very long process step;
    note: This is a very very long note
stop

@enduml

PlantUML Link

arnaudroques commented 5 years ago

I'm not sure if it should, but wrapWidth doesn't seem to be working in Activity (Beta) for notes:

Thanks for the report. This is fixed in last beta http://beta.plantuml.net/plantuml.jar

zimchaa commented 5 years ago

Thanks for the report. This is fixed in last beta http://beta.plantuml.net/plantuml.jar

This is amazing - not sure you're watching this but I've downloaded the beta and confirmed it sorted on Windows (7) (doesn't use GraphViz but: latest verstion).

Note wrapWidth Test.txt note wrapwidth test

jensborrmann commented 5 years ago

Should wrapping work for state diagrams as well? We have some long state names...

arnaudroques commented 5 years ago

Could you post a short snippet that shows the issue ? Thanks

jensborrmann commented 5 years ago
@startuml

state "a" as a
state "In my humble opinion this is definitively too long for a state name one liner and would benefit from wrapping" as b
a -right-> b

@enduml
arnaudroques commented 5 years ago

Thanks your example. This should be fixed in last beta http://beta.plantuml.net/plantuml.jar

@startuml
skinparam wrapWidth 150
state "a" as a
state "In my humble opinion this is definitively too long for a state name one liner and would benefit from wrapping" as b
a -right-> b
@enduml

Tell us if it's not working for you!

jensborrmann commented 5 years ago

Thanks for fixing this. What I forget to include in my example is an additional setting: hideEmptyDescription, which seems to prevent the wrapping from happening:

@startuml
hide empty description
skinparam wrapWidth 150
state "a" as a
state "In my humble opinion this is definitively too long for a state name one liner and would benefit from wrapping" as b
a -right-> b
@enduml
arnaudroques commented 5 years ago

Ok, your example should work with new beta http://beta.plantuml.net/plantuml.jar Tell us if you find other issues! Thanks

Godsmith commented 5 years ago

Hi!

wrapWidth does not seem to be affecting descriptions in state diagrams. i.e.

@startuml
skinparam wrapWidth 150
state "a" as a
State "b" as b
b: aaaaaaa bbbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffffff ggggggggg hhhhhhhh
a -right-> b
@enduml

I know I can insert line breaks manually, but it is not really feasible in my current use case since I'm generating these diagrams from code.

arnaudroques commented 5 years ago

Thanks again for the feedback. It should be fixed in last beta http://beta.plantuml.net/plantuml.jar

Godsmith commented 5 years ago

That was quick! Also, if you did not fix this simultaneously, it is not working for line labels in state diagrams either:

@startuml
skinparam wrapWidth 150
state "a" as a
State "b" as b
a -right-> b : aaaaaaa bbbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffffff ggggggggg hhhhhhhh
@enduml
arnaudroques commented 5 years ago

For some reason, we use a different setting for labels in arrow and lines:

@startuml
skinparam maxMessageSize 150
state "a" as a
State "b" as b
a -right-> b : aaaaaaa bbbbbbbbbb ccccccccc ddddddddd eeeeeeeee ffffffffff ggggggggg hhhhhhhh
@enduml

In your case, you could set both value (maxMessageSize and wrapWidth) to 150.

BTW we are not 100% satisfied with current names (maxMessageSize and wrapWidth), so any idea is welcome! (We will ensure ascending compatibility even if we change those names)

Hope this help!

Godsmith commented 5 years ago

Awesome, thank you!

Naming really is the hardest problem in programming. If you don't need two separate parameters, perhaps it could be just maxTextWidth or wrapTextWidth? If you need separate parameters, perhaps maxLabelWidth and maxElementWidth? Not sure if there is some better terminology to use though.

judebert commented 4 years ago

In class diagrams, long constructors get word-wrapped (thanks!), but I expected the visibility indicator (the green circle) to be aligned with the top of the block, and the wrapped parameters to be indented.

http://www.plantuml.com/plantuml/uml/LSwn2i90383X_PuYew93SHIH5dHr4iGnj846xt974j4YlhitgHr_lkLlpL7zdcAm6qj1nGGFnNBXmKVOD4te8vh1WL8MSqNdBF0A0AiT2_j-GSyIkVSJ9jh2yHThGCa-afwdKgNxHfM9lFl7wwoNuHrQag5UVG00

arnaudroques commented 4 years ago

Last beta http://beta.plantuml.net/plantuml.jar should align visibility indicator on top.

leilapearson commented 4 years ago

Could wrapwidth also apply to class names?

Examples where this would be handy

@startuml
hide members
hide circle

skinparam wrapwidth 200

!unquoted function descriptiveClass($alias, $name, $description)
class "==$name\n\n $description" as $alias 
!endfunction

!unquoted function crc($alias, $name, $responsibility, $collaboration)
class "==$name\n\n**Responsibility**\n$responsibility\n\n**Collaboration**\n$collaboration" as $alias 
!endfunction

class "==Book\n\n Here is a long section of descriptive text. Can I get it to wrap automatically instead of just continuing?" as book
class "==Shelf\n\n **Responsibility**\nHold books as part of a bookcase\n\n**Collaboration**\nBookcase, Book" as shelf
class "==Bookcase\n\n **Responsibility**\nHolds shelves\n\n**Collaboration**\nShelf" as bookcase

descriptiveClass(school, "School", "Schools include pre-schools, elementary schools, middle schools, high schools, colleges, universities, technical institutes, etc.")

crc(city, "City", "Groups Infrastructure", "Neighborhood, Street, Residence, Business, Park, School, Hospital")
@enduml

I was using wrapwidth with rectangles that had names with long descriptions and it was working fine, but I needed some of the features of classes - in particular the ability to use nodesep and ranksep. Unfortunately switching to classes made me lose the wordwrap functionality.

cherub-i commented 2 years ago

When I position a note e.g. left of test::member, the wrapWidth is not enforced. It would be great, if this kind of note was included in the width controlling.

Example

fkleedorfer commented 1 year ago

It would be nice to have this in work breakdown structures, too!

arnaudroques commented 1 year ago

Thanks for the report.

This has been fixed in last snapshot and on the online server.

Tell us if you find other issues!

fabolhak commented 1 year ago

@arnaudroques Thank you for providing the wrapWidth skin parameter :). Is it planned to also be able to use it in Activity Diagrams?

The following example does not wrap unfortunately:

@startuml
skinparam wrapWidth 100
:this is a very long long long long long activity description;
@enduml
The-Lum commented 1 year ago

Hello @fabolhak, and all,

For that you can now use style (instead of old skinparam) as:

@startuml
<style>
element {
  MaximumWidth 100
}
</style>

:this is a very long long long long long activity description;
@enduml

Enjoy, Regards.

fabolhak commented 1 year ago

@The-Lum thank you for the quick response :). Using MaximumWidth works fine for me

BenceSzalai commented 1 year ago

I am looking for a way to only enforce max width for notes.

Rationale: I'm working with class diagram, and for the classes the one line = one property/method is very important to have clear readability in the diagram. However notes typically contain longer text, without such positional meaning, so those would be best auto-wrapped to a certain width, without affecting the way classes are laid out. In fact I am happy with the layout of all drawing elements, only would like to maximise the width of notes.

@arnaudroques

Note sure if we should have separate settings for notes, components...

Certainly notes are very different from any other elements, so it would be great to have a width control for notes only! wrapNoteWidth would be incredibly useful!

The-Lum commented 1 year ago

@BenceSzalai, @arnaudroques:

I just open this wanted request here:

Regards.

BenceSzalai commented 1 year ago

That's nice, but I'm afraid that supporting max-width for all elements is a much bigger work than just for notes, as the issue originally requested, and it is certainly better to have some useful features in a realistic time-frame than a huge, all-encompassing feature, that is so big it it may never get delivered eventually.

arnaudroques commented 1 year ago

This should be fixed in V1.2023.0 Tell us if you find other issues! Thanks

BenceSzalai commented 1 year ago

Thanks! So for reference, to set minimum and maximum width of notes one can add this to the puml file:

<style>
note {
  MinimumWidth 100
  MaximumWidth 150
}
</style>

I've just tried and it works fine in Class diagrams. Great to have it!

Not sure why some things are controlled by skinparam-s and why some by an embedded <style>, but that's not really the topic here.

Not sure, maybe this issue can be closed now?

The-Lum commented 1 year ago

Hi all,

Not sure, maybe this issue can be closed now?

[This is an Issue Review] This is now fully fixed and answered.

Regards.