How can you set the axis limits dynamically so that it always shows say until today + 90 days. I managed to to define the axis limits based on years
"scale": {"domain": [{"year": "year(now())"}, {"year": "year(now())+2}"]}
but what I am looking for conceptually is something like this
"scale": {"domain": [{"year": "year(now())"}, {"date": "now() + dateOffset(days=90)"]}
Here's a simple example in Vega Editor
I searched documentation and googled a fair bit but did not manage ti find a solution. Also it looks like "month" doesn't accept an expression while "year" does, the code below doesn't work.
{"year": "year(now()) + 1", "month": "month(now())"}
see the example
One day is 1000*60*60*24
{
"data": {
"values": [
{"date": "2024-02-15", "value": 100},
{"date": "2024-05-15", "value": 90},
{"date": "2024-06-15", "value": 125}
]
},
"mark": "point",
"encoding": {
"y": {"field": "value", "type": "quantitative"},
"x": {
"field": "date",
"type": "temporal",
"scale": {"domain": [{"year": "year(now())"}, {"expr": "now()+ ((1000*60*60*24)*90)"}]}
}
}
}