render({
data: { values: restaurants },
layer:[
{
transform: [{ calculate: '"Mean"', as: "statType" }],
"mark": {type: "tick"},
"encoding": {
x: {"field": "lat", "type": "Q", aggregate: "mean",
scale:{
domain:[47.65, 47.67]
},},
y: {"field": "key", "type": "N"},
color: {"field": "statType",
type: "nominal",
legend: { title: "Statistic Value" }}
}
},
{
transform: [{ calculate: '"Max"', as: "statType" }],
"mark": {type: "tick"},
"encoding": {
x: {"field": "lat", "type": "Q", aggregate: "max",
scale:{
domain:[47.65, 47.67]
},},
y: {"field": "key", "type": "N"},
color: {"field": "statType",
type: "nominal",
legend: { title: "Statistic Value" }}
}
},
{
transform: [{ calculate: '"Min"', as: "statType" }],
"mark": {type: "tick"},
"encoding": {
x: {"field": "lat", "type": "Q", aggregate: "min",
scale:{
domain:[47.65, 47.67]
},},
y: {"field": "key", "type": "N"},
color: {"field": "statType",
type: "nominal",
legend: { title: "Statistic Value" }}
}
},
{
"mark": {type: "bar", opacity: 0.4, color: "orange"},
"encoding": {
"x": {"field": "lat", aggregate:"q1",
scale:{
domain:[47.65, 47.67]
},
},
"x2": {"field": "lat", aggregate:"q3"},
"y": {"field": "key", "type": "N"},
color: {"field": "key", "type": "N"}
}
}
]
})