Reshape: wide to long
The most common transform. Many datasets are wide — one column per series:transform.reshape pivots wide to long so you can map the new category column to color:
string[]
The numeric columns to collapse into rows. Defaults to all numeric columns.
string[]
Columns to carry through unchanged. Defaults to all categorical/temporal
columns.
string
default:"key"
Name of the output column holding the original column names.
string
default:"value"
Name of the output column holding the values.
Other transforms
operator is one of 'eq', 'neq', 'gt', 'gte', 'lt', 'lte'. Note that neq belongs to
this comparison vocabulary only — the highlight predicate language
has no neq and writes the same idea as { not: … }.
direction is 'asc' or 'desc', defaulting to 'asc'.
op is one of 'count', 'sum', 'mean', 'median', 'mode', 'min', 'max'. The first four
always produce a numeric output column; mode, min and max keep the source column’s type — which
decides whether the result can be mapped to a continuous scale.
transform.constant’s type is a DataType: 'numeric', 'categorical' or 'temporal'.
Spec-level vs layer-level
Piping a transform into the spec applies it to all layers. To reshape the data for a single geom — for example, a line overlay that needs a different shape than the bars beneath it — passtransforms on that geom:
Next
- Statistics — per-layer summaries that run after transforms
- Mappings & aesthetics — reference the columns a transform produces

