Search code examples
vegavega-lite

get vega/vega-lite spec after programmatic data updates via views


I made changes to a vega-lite chart via view.change (here), then I want to export the vega-spec. I checked how the buttons in vega-embed does it (code) but realized that it just references the original spec. I need the vega spec after. Any one has any ideas how? The view APIs don't see to give a, "get spec" functionality.

Thanks!


Solution

  • View updates do not change the spec but only the state of the dataflow. Use view.getState to get the state. More at https://vega.github.io/vega/docs/api/view/#view_getState.