Positioning and sizing¶
Every visible item is placed on the card with card coordinates. On a normal square card, 0, 0 is the top-left and 50, 50 is the center; individual tools then add their own size settings such as radius, width, or height.
This page explains the card coordinate system, how xpos and ypos place an item, and how aspectratio changes the shape of the complete card.
Position an item¶
The card positions visible items by their center, so xpos: 50 and ypos: 50 place an item in the middle of a normal card.
xpos | ypos | | --- | ---: | ---: | | Top-left | 0 | 0 | | Center | 50 | 50 | | Bottom-right | 100 | 100 | Use intermediate values to place the item anywhere between those points.
yposc is an alternative vertical-center coordinate accepted by layout items. It uses the same 0–100 coordinate scale as ypos. Normal configurations can use ypos; where yposc is set, the card uses it as the vertical center instead.
Make the card wider or taller¶
Use layout.aspectratio to change the shape of the card:
```yaml linenums="1" layout: aspectratio: 1/1 # Square card
```
```yaml linenums="1" layout: aspectratio: 1.5/1 # 1.5 times wider than high
```
```yaml linenums="1" layout: aspectratio: 1/1.5 # 1.5 times higher than wide
```
Each tool explains its own size settings. For example, a Circle uses a radius, a Rectangle uses width and height, and a Sparkline uses width and height.
Change which item is drawn on top¶
Use zpos to change the layer position of an item. Larger values are drawn above items with lower values. If you omit it, each layout section uses its own default so the normal tool types appear in a predictable order.
| Layout section | Default zpos |
|---|---|
| Arcs | 100 |
| Rectangles | 200 |
| Polygons | 250 |
| Circles | 300 |
| Horseshoes | 400 |
| Lines | 500 |
| Icons | 600 |
| Sparklines | 650 |
| Areas | 700 |
| Names | 800 |
| States | 900 |
| Texts | 1000 |
| Controls | 1100 |
dzpos adds an offset to that resolved layer position. Its default is 0. For example, dzpos: 1 moves an item just above the normal layer for its own section without replacing the section's zpos.
Mirror an item¶
Layout items that support flip can be mirrored without changing their position. The default is none.
none— leaves the item unchanged.x— mirrors it horizontally, left to right.y— mirrors it vertically, top to bottom.both— mirrors it horizontally and vertically.
Move several items together¶
Use a group when several items belong together and should move as one block: