Left-aligning transition text in state diagrams

0 votes
asked Jan 19, 2015 in To be sorted by anonymous
Guys, first of all thanks fo the great tool - have discovered PlantUML recently, and it seems very promising.

Having skimmed through the guide, looks like there's no builtin way to make the text of a transition event in a state diagram left-aligned. I'd like to display some code along with the event, so the default center alignment doesn't look very good in this case.

Coud you give me any pointers as to the classes/methods in the PlantUML codebase responsible for outputting the text and/or computing the bounding boxes, so that I could patch my local version to display events left-aligned?

Many thanks!


1 Answer

0 votes
answered Jan 19, 2015 by plantuml (279,680 points)
Best answer


Could you post here a diagram as example, so that we could better understand what you are trying to do.

About State Diagram, you have to know that Dot/Graphviz is used for the rendering, and sometimes it gives limitation on what we can do.

You can add the current line in your diagram:

!pragma svek_trace on

This will generate on your disk the temporary dot files used by PlantUML : it may help you to understand how the whole process works.

Thank you.

commented Jan 19, 2015 by anonymous

Thanks for the quick response. Thanks for the tip - will try out the pragma and see if I can dig out something.

Here's the simplest diagram that illustrates the issue:

[*] --> One
One --> Two : Alpha {\n  Foo();\n   Bar();\n}

As you can see, the code in the Alpha event body is center-aligned.

Thanks again,
commented Jan 19, 2015 by plantuml (279,680 points)
We've just uploaded a new beta version

This beta version supports the following syntax:

skinparam defaultTextAlignment left
[*] --> One
One --> Two : Alpha {\n  Foo();\n   Bar();\n}

Feedback welcome!
commented Jan 19, 2015 by anonymous
Hooray!!! You guys are awesome!!!

Just FYI - on OS X 10.10 it has logged the following (the version I've downloaded yesterday worked silently):

Jan 19 21:40:14 iMac.local java[18782] <Error>: The function ‘CGContextErase’ is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance.

The image was totally OK though, so no big deal.

Thank you, thank you, thank you!!!