2021-12-22

Set domainMin to 6 months before max date in data

I have the following Vega-Lite chart:

Open the Chart in the Vega Editor

Currently, I have the scale set as follows:

"scale": {"domainMin": "2021-06-01"}

However, what I really want is for the domainMin to be automatically calculated to be 6 months before the latest date in the notification_date field in the data. I've looked at aggregate and expressions, but it's not exactly clear.

How can I get the maximum value of notification_date and subtract 6 months from it, and use that in "domainMin"?

Edit: To clarify, I don't want to filter the data. I want the user to be able to zoom out or pan to see the data outside the initial 6-month window. I get exactly what I want with "scale": {"domainMin": "2021-06-01"}, but this becomes out-of-date very quickly.



from Recent Questions - Stack Overflow https://ift.tt/3FiqyVx
https://ift.tt/eA8V8J

No comments:

Post a Comment