Adjust the position of the arrow’s text in timing diagram

0 votes
asked May 10 in Wanted features by anonymous

As shown in my 1st figure, when two arrows are very close, there text will overlap, making it difficult to read. Is there an option to adjust the position of the text (such as my 2nd~4th figures)?

image

image

image

image

commented May 10 by JimN (940 points)
Hello. Can you repost the images?  I'm currently seeing broken links.
commented May 11 by JimN (940 points)
Or, can you share an example script?   I recently made changes that allow the message text font style/size/color to be set independently from the arrow itself, so that part of the program is fresh in my mind.  

Regards.

2 Answers

0 votes
answered May 11 by anonymous
Thank you very much for your reply!!

I add the example script.

@startuml

binary "sig_a" as A
@A
0 is 0
1 is 1
2 is 2
5 is 1
6 is 0

binary "sig_b" as B
@B
0 is 1

binary "sig_c" as C
@C
0 is 1
5 is 0

binary "sig_d" as D
@D
0 is 1
6 is 0

A@5 -> D@6 :1T
C@5 -> D@6 :1T

@enduml
0 votes
answered May 13 by The-Lu (69,260 points)

Hello A., and all,

Here are some proposals, with `\n` or `unicode space`:

@startuml

binary "sig_a" as A
@A
0 is 0
1 is 1
2 is 2
5 is 1
6 is 0

@5 <-> @6 : 1T

binary "sig_b" as B
@B
0 is 1

binary "sig_c" as C
@C
0 is 1
5 is 0

binary "sig_d" as D
@D
0 is 1
6 is 0

A@5 -> D@6 : 1T\n
C@5 -> D@6 : <U+0020><U+0020>1T

@enduml

Enjoy,
Regards,
Th.

commented May 13 by JimN (940 points)

Hi The-Lu, 

That's nice to see a possible workaround to the current positioning.   I experimented to see if I could move the default positioning, but there are some problems with any solution I came up with.  The best results I've achieve so far is just to position the text at the arrow line centers, rather than right at the arrowhead.  

image

While automatically separating these two labels, there are still potential conflicts when messages cross through each other (some going up, some going down) and crossing near the center, where their labels are.  So this pretty much just moves one problem location to another.  But, probably for most cases, the center position would work fine. 

Also, in my test, I have the text center at the lower-left corder on down directed messages, and on the upper-right corner on up directed messages.  This does avoid some conflicts, such as if two arrows cross at the middle.  Here was a diagram showing different directions:

image
I can post the PlantUML script if needed.  

Do you know of other diagrams that may have this label overlap problem? It seems that class, object, component, etc, move the arrows and the label positions so as not to conflict.  The Timing Diagram has less space for this, though ideally it still would be nice if the automated drawing could ensure the labels aren't overlapping.

Regards,

Jim N.

commented May 13 by JimN (940 points)
edited May 13 by JimN

The-Lu, are you referring to this one?:image

Here's what positioning in the middle (as I described) does.  It helps in some respects, but has problems in other respects:

image

Interestingly, when using the Arrow Font settings that I recently fixed, the message font can be made smaller, the color can change, etc., to help.   Here's an example (though maybe too light):

image

I'm not sure any fixed position (i.e. at the arrow, at the middle) is going to be perfect for every diagram.   A simple solution might be to give the user some choice about where along the line it goes (even if just a few set positions) and possibly which side of the arrow.   Ideally, the layout engine would evaluate these label positioning conflicts and place them accordingly -- though such changes would be more difficult right now for this diagram.

I haven't looked at the other links you shared yet of other positioning problems.  I look forward to doing so.  Maybe it will reveal an overridding solution.

Regards,

Jim Nelson

commented May 13 by JimN (940 points)

...Though if there were a setting that increased the heights of the lanes (not the height of the timeline drawings), then the positioning I showed in my experimental fix (at the middle of the arrow lines) would have less conflict with the timeline elements themselves.   I've looked around for such a setting, but could not find one.  The Height keyword on a participate, such as:

Server  is 80 pixels height

Changes the height of the drawing, so there is still too little space between each lane for the message text to fit within.

I also looked at the "padding" skin param, but it pushed the text away from the arrow line, which isn't where I want to the padding. :(

Jim N

...