Previous: Defining and Arranging Blocks, Up: Block Diagram Language Tutorial [Contents]

### 6.2 Arrows and Lines

You can use various arrow symbols (as in other languages) to impact the appearance of the arrow. like `>>` or `=>`. You can even use symbols without arrowheads (`--`, `..`, `++` and `==`) to get a simple line.. In addition, you can specify additional attributes in square brackets after the arrow. These include line, arrowhead and text attributes.

You can add labels to arrows simply using the colon label syntax. You can also add further labels after the arrow, specifying their position along the arrow as percentage of length. By default the labels are placed above the arrow, you can influence it via the `label.pos` attribute. If you indicated the `mark` keyword before the label, a small mark will be added to the arrow. This mark is an arrowhead defaulting to `gvstyle=tick`.

Now, it might be that you would like to route the long connection below the container block. In such cases you can use the `via` attribute for an arrow. You can name a block and any of `top`, `left`, `right` or `bottom` after it. The arrow will try to go that way.

Arrows are routed around blocks in-between the two ends of the arrow. This can be prevented by setting the `allow_arrows` attribute.

Arrows can start and end not only at blocks. Based on the block layout, you can specify 2D coordinates on the diagram, which can serve as start, end and waypoints for arrows.

To specify a coordinate, use two block sides, separated by a comma and enclosed in parenthesis, for example: `(a@top, b@right)`. You can also add offsets in pixels, like `(a@top+10, b@right-5)`.

Arrows can be laid out using several algorithms. Use the `routing` attribute and choose one between `horizontal`, `vertical`, `straight`, `manhattan`, `polygon` or `curvy`. In case of `polygon` and `manhattan`, you can set `line.corner` to influence the appearance and make the vertices smoother via `line.corner=round`. The default is `curvy`.

In case of `vertical` and `horizontal` the line will be drawn in the middle of the vertical or horizontal overlap of the two blocks, respectively.

You can govern where arrows end via ports, similar to graphviz. These should be specified after the block name and the at symbol (`@`). Boxes have one port on each side and vertex. You can also use a compass point as port. Each of these also influence the direction in which the arrow shall leave or arrive at the block. With the `distance` attribute you can govern, how wide a certain block (or all blocks) are routed around or - in case of starting and ending blocks - how wide an arc the arrow makes at its start or end. The default is 5 pixels for the former and 10 pixels for the latter.

Each shape may define its own ports (besides the compass points, which are valid for all shapes). For example, the shape `actor` has one compass point for each hand and leg, plus its head. In the below example, we also use a direction marker in addition to the port to explicitly govern the direction the arrow start in or ends from. (The attribute `label.align` determines where on the arrow the label is placed with 0 being its start and 100 being its end (default is 50). `label.pos` on the other hand specifies which side of the arrow the label is (default is above).)

If two arrows would overlap at their start or end, they are automatically shifted a bit to show up as separate arrows. (Note, as well, that the arrowheads follow the curvature of the arrow. The `xmul` attribute simply makes them longer.)

You can use a syntax similar to arrows to specify separator lines. Note that the default routing for lines is `straight`, which does not go around blocks in the way, but just crosses them. If you set `routing=curvy`, the line will route around blocks in the way arrows do, see the red line on the example below.

Finally, a more elaborate version of lines, labels and markers. Note that the plain numbers used in the coordinates are interpreted relative to the inner margin of their container block. (If there is no outer block then to the diagram canvas.) The numbers after the `mark` commands are not followed by a percentage sign, so they are interpreted as pixels from the beginning of the line.

Previous: Defining and Arranging Blocks, Up: Block Diagram Language Tutorial [Contents]