Missing arrow label

2 Answers

0 votes
answered Nov 4, 2020 by The-Lu (63,920 points)

Hello L.,

The right syntax is '-[#color]->':

visysus -[#8080FF]-> stjhcgvt: THIS IS SHOWING

Then, the expected result is observed:

→ Link to diagram on PlantUML server

Regards,
Th.

commented Nov 4, 2020 by Leo
Ugh... Sorry, I missed that by a mile. Why doesn't that throw a syntax error?
commented Nov 4, 2020 by The-Lu (63,920 points)

Hello L.,

Because all are correct, depending of the layout ("top to bottom" or "left to right"), and in your case you are more on "top to bottom" mode.

Here are the two examples:

state a
state b
state c

a -[#8080FF]> b: THIS IS SHOWING
a -[#8080FF]-> c: THIS IS also SHOWING


[See on plantUML server]

If that can help,
Regards,
Th.

commented Nov 4, 2020 by Martin
Th., I don't follow.  Why does your use of -> create a horizontal arrow and arrow text, and OP use creates a vertical arrow and no arrow text.  I can't see what the differentiation is?
commented Nov 4, 2020 by Martin
edited Nov 5, 2020

OK, it's to do with contradiction of depth.  As we know -> is same depth, --> is +1 depth, ---> is +2 depth.
Compare:

@startuml
state x
state y
state a
state b

x --> a
x --> y
y --> b
a -[#8080FF]> b: THIS IS SHOWING
@enduml

against 

@startuml
state x
state y
state a
state b

x ---> a
x --> y
y --> b
a -[#8080FF]> b: THIS IS SHOWING
@enduml

All I did to fix was to extend the depth between x and a by +1.

So if the OP was intending for a horizontal arrow, then the fix is actually to this line:
lsfwqjhyjkj -[#8080FF]-> visysus: rcevz

becomes
lsfwqjhyjkj -[#8080FF]--> visysus: rcevz

commented Nov 5, 2020 by The-Lu (63,920 points)
Thank you Martin,

Thank you for the explanation: that's exactly it.

I answered quickly without going as far as the real explanation.

Regards,
Th.
+1 vote
answered Nov 5, 2020 by Martin

The issue is that plantuml is not inferring the relative depths well; plus there may be a bug with not placing the arrow text in such as case.

These two lines imply that stjhcgvt is +2 below lsfwqjhyjkj :

lsfwqjhyjkj -[#8080FF]-> fajspuwgk: lrgzoad

fajspuwgk -[#8080FF]-> stjhcgvt: mavzke

This line implies that visysus is +1 below lsfwqjhyjkj :

lsfwqjhyjkj -[#8080FF]-> visysus: rcevz

But this line implies that visysus and stjhcgvt are at the same level :

visysus -[#8080FF]> stjhcgvt: THIS ISN'T SHOWING

I guess plantuml can't cope well with the contradiction.  I mean you might expect it to bump visysus down to the same depth as stjhcgvt to meet the requirement (that's if you assume that -> should bind stronger than -->).

This explains the downward pointing arrow, but not the lack of arrow text, which might also be a bug.

Assuming that -[#8080FF]> isn't a typo (and by OP reaction above it probably was....in which case, as Th. pointed out, the correction is -[#8080FF]->), then a fix is to force a depth of +2 between visysus and lsfwqjhyjkj by using a ---> instead of a -->

i.e. 

lsfwqjhyjkj -[#8080FF]--> visysus: rcevz

See my comment on Th.'s answer for some pictures.

(Interestingly you can put the [#8080FF] anywhere inside the ---> arrow, so --[#8080FF]-> or ---[#8080FF]> also work the same as -[#8080FF]-->).

...