🏥 🏭 Working on the COVID-19 response in Canada? Plotly & the Canadian government can help you and your organization. Learn more and get in touch.

Using getter for trace values breaks image download?

Hello everyone,

Recently I’ve modified one of my charts to use a getter for the y values in a scattergl plot (line charts). The entire trace object is actually a MobX observable which is modified when some chart setting state changes. This generally works fine for the chart itself, but it appears it breaks the image download feature.

Does anyone know if this is a Plotly bug or intended feature?

For anyone interested, I’ve found out why this happens.

I’m using Plotly.downloadImage(element) to initiate the image download. When doing so, Plotly uses deep extend function to copy the data array, and while doing that it apparently is not able to copy the getter correctly. So instead, I used the lower-level function directly:

Plotly.Snapshot.downloadImage({ data, layout, config})

With this, the data is not deep-extended, and image download works as expected. I’m not aware of any workarounds for the image download modebar button, though.