I am trying to display a horizontal rule at a constant value in Vega-Lite, without success. Here is the code (can be pasted in https://vega.github.io/editor/#/):
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"encoding": {
"x": {"field": "ts", "type": "temporal"},
"y": {"field": "a", "type": "quantitative"}
},
"layer": [
{
"data": {
"values": [
{"ts": "2021-11-26", "a": 0.16},
{"ts": "2021-11-28", "a": 0.12}
]
},
"mark": { "type": "point" }
},
{
"data": { "values": [] },
"mark": {"type": "rule", "color": "red"},
"encoding": {"y": {"datum": 0.15, "type": "quantitative"}}
}
]
}
In this code, I use a second layer to overlay a rule for a constant value, but it just doesn't show up. Any ideas?
