I am trying to port some D3.js graphs to Vega Lite to make it faster to iterate on new designs. The current example is a bar char with buttons underneath which change the data being displayed. Importantly, the y-label of the data will change as the data does (the x-does not) as does the need for a legend (some sets of data have more than one series, others just 1 and don't need a legend)
I have more or less reproduced the graphs themselves in Vega Lite, however I am having an issue ensuring the plots have their axes aligned. Even in the case where there is no legend in either plot, the change in y-label/y-values means the fixed sizing moves things around.
I have uploaded a GIF to show what I mean.
Currently the buttons function by taking the Vega Lite template and updating it based on a new set of data (basically just changing the dataset and labels, domain, etc).
Is there any way to align these or is that out of scope for Vega Lite?
EDIT:
After tinkering a bit I have found it seems to be a padding issue (see new GIF). What I changed was the formatting of the yaxis and pushing the yaxis back from the axis which seemed to 'brace' the plot against everything else. This shows that in principle this alignment (even if by fluke/brute force) is possible. However, when i close the sidebar of the responsive page I am on, the problem re-emerges. I also set 'align':'all' and 'padding':10. A higher padding 'braces' it more but then just fills the place with loads of whitespace.