How to correct PlantUML Line Path

前端 未结 4 1488
夕颜
夕颜 2020-12-13 09:52

I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded p

相关标签:
4条回答
  • 2020-12-13 09:59

    If anyone wants to know a more specific, put probably much more useless answer, here is what I did in the end.

        order -down- publisher
        publisher -[hidden]up- order
    

    so for some reason adding the duplicated command both ways solves it.

    0 讨论(0)
  • 2020-12-13 10:00

    To make a connection less important in the layout, use [norank], e.g., a -[norank]-> b

    0 讨论(0)
  • 2020-12-13 10:03

    Try the options suggested by @Peter Uhnak along with linetype :

    skinparam linetype polyline
    skinparam linetype ortho
    

    Give better options for lines. Using ortho - (Here)

    you will get -

    0 讨论(0)
  • 2020-12-13 10:24

    There are some tricks that you can try, listed below. The layouting itself is performed by GraphViz (dot layouting iirc), and GraphViz simply does this sometimes. Graph layouting is a NP-complete problem, so algorithms usually take harsh shortcuts.

    Typical workarounds that I've seen or used include:

    • adding hidden lines a -[hidden]- b
    • extending the length of a line a --- b (more dashes, longer line)
    • specifying preferred direction of lines (a -left- b)
    • swapping association ends (a -- bb -- a)
    • changing the order of definitions (the order does matter... sometimes)
    • adding empty nodes with background/border colors set to Transparent

    So if you really want to have a nice layout, you'll need to put some elbow grease in, but keep in mind that the layout will be still brittle -- if you add/remove items, you might need to redo it again.

    0 讨论(0)
提交回复
热议问题