I’d like the top bar “Download plot as a png” button to send the image data to server (for example via Javascript fetch) instead of triggering a browser file download.
I see there are Plotly.toImage and Plotly.downloadImage that could be used, but how to redefine the standard “Download plot as a png” button to do that?
I think you’d have to capture the event where this is the target, then convert the figure to a stream for use with the fetch request.
Would you have an example? Which event should we capture? And how to get the figure image as PNG data? so that I can send it with XMLHttpRequest or fetch?