Text
Free-positioned text annotations and in-chart callouts.
Use text marks for annotations positioned at raw x and y coordinates. Text does not follow bar or area stacking. For ordinary data labels, use the label property built into bars, lines, areas, dots, and pies instead.
Annotate a point
Layer text over another mark when the annotation is part of the story rather than a standard data label. The text property names the field to display:
dy: -14 shifts the annotation 14 pixels above its raw data coordinate.
Custom text field
Display any string or number field from your data, not just x or y:
Alignment
textAnchor controls horizontal alignment relative to the data point:
| Value | Behavior |
|---|---|
"start" | Left-aligned at the point |
"center" | Centered on the point (default) |
"end" | Right-aligned at the point |
Properties
| Field | Type | Default | Description |
|---|---|---|---|
text | string | "text" | Field name to display as the label. |
dx | number | 0 | Horizontal offset in pixels. |
dy | number | 0 | Vertical offset in pixels. Negative moves up. |
fontSize | number | – | Override the theme font size. |
fontWeight | string | – | Override the font weight. |
textAnchor | "start" | "center" | "end" | "center" | Horizontal alignment. |