Yes, you can dynamically build axis labels in Deneb (Vega-Lite) by creating a calculated field that combines values from multiple columns.
How to do it
Use a calculated field in your encoding:
"encoding": {
"x": {
"field": "CombinedLabel",
"type": "ordinal",
"axis": {"title": "Category + Region"}
}
}
Then define CombinedLabel in a transform:
"transform": [
{
"calculate": "datum.Category + ' - ' + datum.Region",
"as": "CombinedLabel"
}
]
-
Use calculate transform to combine columns.
-
Bind the new field to the axis for dynamic labeling.
-
This makes your axis labels more descriptive and context-aware.