Skip to main content
Data labels print each observation’s value directly on the observation. Unlike the other topics in this section, they’re not a config field — they’re a per-layer option on a geom, because a label attaches to a specific observation.

Options

showDataLabels
boolean
default:"false"
Turn labels on for this layer.
format
'absolute' | 'percentage'
default:"absolute"
Show the raw value, or its share of the total.
position
'auto' | 'inside' | 'outside'
default:"auto"
Where the label sits relative to the observation. 'auto' lets the engine fit, flip or drop labels as space allows; 'inside' and 'outside' render exactly as asked.
justify
'start' | 'center' | 'end' | 'panel-start' | 'panel-end'
Anchor along the observation’s value axis. 'end' is the value tip whatever the orientation. Only consulted when position is explicit.
align
'start' | 'center' | 'end'
Anchor across the observation’s other axis. Only consulted when position is explicit.
offset
number
Gap in pixels between the observation’s edge and the label. Defaults to 4 for bars and wedges, 12 for points and lines.
showStackTotals
boolean
default:"false"
On stacked bars, print the stack total at the end of each stack.
showCategoryLabels
boolean
default:"false"
On polar bars (pie/donut) prepend the category to the value (“North · 35%”). On cartesian bars, emit a second category label per bar.

Examples

Percentage labels on a pie’s wedges, with the category name:
Totals at the top of each stacked column: