简体   繁体   中英

Can you re-render vega-lite chart without terminating the old one?

I know there's some streaming models and other smart ways to update the chart.

But is it possible to do even simpler, just call vegaEmbed(element, vegaSpec) on the same element multiple times, so the new chart will replace the old one?

It works, but I wonder if there's some memory leaks or if you need somehow properly terminate the old graph?

The Vega view API offers a finalize() method for exactly this: to be called when a chart is no longer needed, in order to prevent memory leaks. See https://vega.github.io/vega/docs/api/view/#view_finalize

Once you call this, it should be safe to overwrite the old chart.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM