x2 axis title in stacked bar is hidden when x has title
{
"mark": "bar",
"encoding": {
"y": {
"field": "question",
"type": "nominal"
},
"x": {
"field": "percentage_start",
"type": "quantitative",
"title": "percentage_start" //<---- change chart view (intentionally)
},
"color": {
"field": "type",
"type": "nominal"
},
"x2": {
"field": "percentage_end",
"type": "quantitative",
"title": "percentage_end" //<---- do not change chart view (expected that both titles would show)
}
},
"data": {
"values": [
{
"question": "Question 3",
"percentage_start": 10,
"percentage_end": 50,
"type": "Agree"
},
{
"question": "Question 3",
"percentage_start": 50,
"percentage_end": 70,
"type": "Strongly agree"
}
]
},
"$schema": "https://vega.github.io/schema/vega-lite/v2.4.1.json"
}

without title

live demo https://iliatimofeev.github.io/sharer/testreport/#diverging_stacked_bar_chart
I think this is actually intended behavior. You are manually setting the title for X and that overrides implicit titles. X2 belongs to X so we don't treat them separately.
Sound logical but in case of titles on both x scales that behavior seems unexpected.
in case of titles on both x scales that behavior seems unexpected.
Good point.
Most helpful comment
Good point.