{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data":{
"url": "data/cars.json"
},
"facet":{
"column": {
"field":"Origin",
"type": "nominal"
}
},
"spec":{
"layer": [
{
"mark": {
"type": "bar",
"clip": true,
"tooltip": true
},
"encoding": {
"x": {
"field": "Cylinders",
"type": "ordinal"
},
"y": {
"field": "Acceleration",
"type": "quantitative",
"aggregate":"average",
"axis": {
"title": "Acceleration",
"orient": "left"
}
},
"color": {
"field": "Cylinders",
"type": "nominal",
"legend":null
}
}
},
{
"mark": {
"type": "line",
"clip": true,
"color":"#ffde25",
"tooltip": true
},
"encoding": {
"x": {
"field": "Cylinders",
"type": "ordinal"
},
"y": {
"field": "Weight_in_lbs",
"type": "quantitative",
"aggregate":"average",
"axis": {
"title": "Weight (lbs)",
"orient": "right"
}
}
}
}
],
"resolve": {
"scale": {"y": "independent"}
}
}
}
output :
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data":{
"url": "data/cars.json"
},
"facet":{
"column": {
"field":"Origin",
"type": "nominal"
}
},
"spec":{
"layer": [
{
"mark": {
"type": "bar",
"clip": true,
"tooltip": true
},
"encoding": {
"x": {
"field": "Cylinders",
"type": "ordinal"
},
"y": {
"field": "Acceleration",
"type": "quantitative",
"aggregate":"average",
"axis": {
"title": "Acceleration",
"orient": "left"
}
},
"color": {
"field": "Cylinders",
"type": "nominal",
"legend":null
}
}
},
{
"mark": {
"type": "line",
"clip": true,
"color":"#ffde25",
"tooltip": true
},
"encoding": {
"x": {
"field": "Cylinders",
"type": "ordinal"
},
"y": {
"field": "Weight_in_lbs",
"type": "quantitative",
"aggregate":"average",
"axis": {
"title": "Weight (lbs)",
"orient": "right"
}
}
}
}
],
"resolve": {
"scale": {"y": "independent"}
}
},
"resolve": {
"scale": {"y": "shared"},
"axis": {"y": "independent"}
}
}
if we add one more resolve, it gives this output
I want to have both the Y axes shared for all 3 graphs, instead of having 2 individual Y axis for each graph. May I know how to do it ?