The vega-lite and vega documentations barely mention how to load data dynamically at run time. However, I couldn't find an example on how to make it work. It seems like you cannot use vegaEmbed for that, and you must use vega viewer. However for this to work you need to compile your spec first to vega.
Built with blockbuilder.org
Thanks very much for this. I was struggling to get it to work using vegaEmbed but this has solved it for me. It almost works with vegaEmbed but the chart would only render when I moused-over the chart and also when the data set was changed it seem to fail to clear previous marks.
How did you figure this out, I'm also struggling to find mention of this in the docs. Vega-lite is so close to being the perfect charting solution but it seems there are some really common use cases that is struggles with!