Open dberenbaum opened 10 months ago
Found https://stackoverflow.com/questions/73404562/can-i-set-a-dynamic-axis-value-using-vegalite. It looks possible but messy mainly because there's no easy way to get sane defaults.
Technically, you can setup dynamic limits easily. See this diff to add it to the linear template:
$ diff linear.json lims.json
18a19,42
> },
> {
> "name": "xmin",
> "bind": {
> "input": "number"
> }
> },
> {
> "name": "xmax",
> "bind": {
> "input": "number"
> }
> },
> {
> "name": "ymin",
> "bind": {
> "input": "number"
> }
> },
> {
> "name": "ymax",
> "bind": {
> "input": "number"
> }
25c49,52
< "title": "<DVC_METRIC_X_LABEL>"
---
> "title": "<DVC_METRIC_X_LABEL>",
> "scale": {
> "domain": {"expr": "[xmin, xmax]"}
> }
57c84,85
< "zero": false
---
> "zero": false,
> "domain": {"expr": "[ymin, ymax]"}
However, the plots will show as blank until you set the axis values:
To avoid this, we need to recalculate default axis limits, which requires doing a transform to calculate the extent of the data and adding it to every row in the data.
See slack thread. It would be useful to have a way to set or adjust the min and max values of the axes.