Stereotype for sequenceMessageAlign

0 votes
asked Sep 13 in Question / help by Senthil Babu Jegannathan

I am trying to align text for a single arrow in sequence diagram. I currently don't have a way to do this. I suppose, I have to use stereotype. But it is not very clear where to specify the stereotype. I tried it in multiple locations, but none of them seem to work.

Examples:

@startuml
skinparam SequenceMessageAlign left
skinparam SequenceMessageAlign<<centered>> center
a -> b : long text here, which is left aligned
b-> a : <<centered>> message 2
@enduml

Another

@startuml
skinparam SequenceMessageAlign left
skinparam SequenceMessageAlign<<centered>> center
a -> b : long text here, which is left aligned
b-[<<centered>>]> a : message 2
@enduml

I also tried this.

@startuml
skinparam SequenceMessageAlign left
skinparam SequenceMessageAlign<<centered>> center
a -> b : long text here, which is left aligned
b-> a <<centered>> : message 2
@enduml 

I expect the text to be centered only for arrow from b -> a.

Thanks! 

1 Answer

0 votes
answered Sep 13 by The-Lu (31,200 points)

Hello S.,

For that you can use `style`, like:

@startuml
<style>
arrow {
HorizontalAlignment left 
}
</style>
a -> b : long text here,\nwhich is left aligned

<style>
arrow {
HorizontalAlignment center
}
</style>
a <- b : message 2
@enduml

But it seems there are some bugs with:

@startuml
<style>
arrow {
HorizontalAlignment left 
FontColor Blue
}
</style>
a -> b : long text here,\nwhich is left aligned

<style>
arrow {
HorizontalAlignment center
FontColor red
}
</style>
a <- b : message 2\nwhy on right!

<style>
arrow {
HorizontalAlignment right
FontColor green
}
</style>
a -> b : long text here,\nwhich is right aligned
@enduml

If that can help,
Regards,
Th.

commented Sep 14 by Senthil Babu Jegannathan

Thanks for the style tag. But as you mentioned, this is still not working correctly.

Also if it matters, the following throws a NullPointerException.

@startuml
a -> b : long text here,\nwhich is left aligned

<style>
arrow {
HorizontalAlignment center
}
</style>
a <- b : message 2
@enduml

I think style is still a Beta feature. It seems HorizontalAlignment property for arrow is some how broken. Let me know, if there is some other short term solution to fix this?

Once again, thanks a lot for the help. Let me know, if I have to report a bug about this somewhere.

commented Sep 14 by The-Lu (31,200 points)

Hello S.,

It seems to be as the similar issue:

Then you can test:

@startuml
<style>
</style>
a -> b : long text here,\nwhich is left aligned

<style>
arrow {
HorizontalAlignment center
}
</style>
a <- b : message 2
@enduml

Awaiting full HorizontalAlignment [local] style management, on sequence diagram: Thank to @PlantUML team.

Regards,
Th.

...