How to correct PlantUML Line Path

前端 未结 4 1490
夕颜
夕颜 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 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.

提交回复
热议问题