Is it possible to wrap swimlane headings automatically rather than using \n?

+1 vote
asked Jul 3, 2018 in Question / help by John
Goes hand-in-hand with a previous request related to wrapping boxes in swim-lanes.

Thank you.
commented Jul 4, 2018 by albert (3,520 points)
Which other question? Give an example of the chart and what you would like to have changed.
commented Jul 4, 2018 by John
Sorry, I might not have worded this well:

----------

@startuml

skinparam wrapWidth 150

| this is an exceptionally long title it would be great if I could set it to wrap at 170 pixels|

:You fixed it so this will wrap at 150 pixels thank you!;

|Ignore Me|

:ignore me;

@enduml

----------

So ideally be able to set the title to wrap at x pixels and the boxes underneath at y pixels. Generally, I would set x at 10/20 pixels more than y.

This will allow a consistent sizing of each lane - so all swimlane diagrams look much the same as each other.

Thanks.
commented Jul 4, 2018 by albert (3,520 points)
edited Jul 4, 2018 by albert
I found in the code "wrapWidth" related to linebreak, I also found "swimlaneWidth" but I think this has a completely different meaning (I could not get it working).

When running the option "-language" on plantuml I see "SwimlaneWidth" in the skin parameter section, but "wrapWidth" is not in the output at all.
Neither "wrapWidth" nor "swimlaneWidth" can be found in the documentation.
I created the question Documentation skinparameters (http://forum.plantuml.net/7882/documentation-skinparameters) for it.
commented Jul 4, 2018 by john
Thanks for looking.

I 'think' there's various undocumented features. wrapWidth has been around for a while and the beta was updated to make it apply to swimlane elements.

But to make the swimlanes truly fixed-size, I need the title width to also be fixed.

Thinking about it, I'm asking for a FIXED swimlane width, which would mean auto-wrapping the title - the contents have already been sorted with wrapWidth.
commented Jul 4, 2018 by albert (3,520 points)
See my updated comment, a mid air collision with your new comment.

2 Answers

+1 vote
answered Jul 5, 2018 by plantuml (294,960 points)

With last beta http://beta.plantuml.net/plantuml.jar you can now have:

@startuml
skinparam wrapWidth 150
| this is an exceptionally long title it would be great which now wrap at 150 pixels|
:You fixed it so this will wrap at 150 pixels thank you!;
|Ignore Me|
:ignore me;
@enduml

This is not exactly your request, but better than before :-)

About autowrapping the swimlane title, we could provide yet another skinparameter SwimlaneWrapTitleWidth that could be set to either an integer value (in pixel) or to "auto" which would mean autowrapping according to the actual swimlane width. What do you think about it ?

commented Jul 5, 2018 by albert (3,520 points)
From a flexibility point of view I would say SwimlaneWrapTitleWidth would be nice.
From a usability point of view I think it would be necessary as in that case the swimlane can be wider than the boxes inside it.

Note: that there must be some sort of restriction on the relation between SwimlaneWrapTitleWidth  and wrapWidt as otherwise strange things might happen.
commented Jul 5, 2018 by John
Thanks for getting back to me.

In pixels or auto would work perfectly for me.

So long as I can fix the wrapwidth at (say) 150 and the title at (say) 170, then that would work - or both at 150.

The added bonus to be able to set it to 'auto' would be useful for other folks I would imagine, but I would always fix both at x and y.

Thank you!
0 votes
answered Jul 7, 2018 by plantuml (294,960 points)

We've just built a new beta http://beta.plantuml.net/plantuml.jar

With this one, you can have:

@startuml
skinparam wrapWidth 150
skinparam swimlaneWrapTitleWidth auto
 
| this is an exceptionally long title  which now wrap at some pixels|
:You fixed it so this will wrap at 150 pixels thank you!;
|Ignore Me|
:ignore me;
@enduml

and also:

@startuml
skinparam swimlaneWidth same
skinparam wrapWidth 150
skinparam swimlaneWrapTitleWidth auto
 
| this is an exceptionally long title  which now wrap at some pixels|
:You fixed it so this will wrap at 150 pixels thank you!;
|Ignore Me|
:ignore me;
@enduml

It should fit some needs. Tell us if you find issue or if something is missing.

Thanks

commented Jul 8, 2018 by John
That looks perfect!

I'll let you know if I have any issues.

Thank you very much.
...