Cache the chart object

Is it possible to cache a chart object? I can cache its data and render it again, but then I will lose zooming and everything else. Any idea?

Thanks

var gd = document.getElementById(/* id of your graph div */)

// then
gd.data
// => gives you your graph's current data array
gd.layout
// => gives you your graph's current layout object

then to really “cache” your data and layout, you’ll need some “extend-deep” utility like

https://www.npmjs.com/package/deep-extend

Thanks for the help. Let me sure I understand. I am storing data and layout references into my cache. And when time comes to restore from the cache I am extending the current chart’s data and layout with the these that been cached ? Is that correct?

Thanks