Diagram line crosses a box: how to fix it
The message means a line runs through a block it does not join, and disappears behind that block.
Updated
{"title": "Bookshop orders",
"columns": [[{"id": "shop", "title": "Online shop", "tiles": ["Checkout"]}],
[{"id": "orders", "title": "Order service", "tiles": ["Orders"]}],
[{"id": "post", "title": "Parcel desk", "tiles": ["Labels"]}]],
"links": [{"from": "shop", "to": "orders"}, {"from": "orders", "to": "post"},
{"from": "shop", "to": "post"}]}
The check: 1 layout problem(s)
line 'shop' -> 'post' crosses 'orders'; route it with via_x/via_y, move a block, or pass cross_ok=TrueWhy does it happen?
The shortest path between the two blocks leads through a third, and blocks are drawn over lines. The check walks along every line and reports each block it enters, apart from the two it joins.
In the columns layout, a line from the first column to the third must pass the second. Here shop to post runs behind orders, and looks like a second line into orders and a second line out of it.
How do I fix it?
Send the line around the block, or move the blocks so its path is clear. The message gives the Python names. JSON uses the same keys, via_x, via_y and cross_ok, and adds lane.
- In JSON, add
"lane": "top"or"lane": "bottom"to the link. - In Python, pass
via_y, a height above or below every block, such asmin(p.y for p in d.placed) - 80. - Or pass
via_x, a position beside the blocks, for a line that should run down the side. - Or set
startandendto other sides of the two blocks. - Or move a block, so the two ends sit side by side.
- Run the check again.
A top lane runs 70 px above the highest block, and each further line in it 30 px higher. A line through a lane always turns at right angles. With the third line in the top lane, the check reports 0 layout problems:
{"title": "Bookshop orders",
"columns": [[{"id": "shop", "title": "Online shop", "tiles": ["Checkout"]}],
[{"id": "orders", "title": "Order service", "tiles": ["Orders"]}],
[{"id": "post", "title": "Parcel desk", "tiles": ["Labels"]}]],
"links": [{"from": "shop", "to": "orders"}, {"from": "orders", "to": "post"},
{"from": "shop", "to": "post", "lane": "top"}]}
The check: 0 layout problems
What if the line should pass behind the box?
Set "cross_ok": true on the link, or cross_ok=True in Python. The line is still drawn behind the block, and the check stops reporting it.