I made several custom modebar buttons, only for 1 button I would like to download something. In order to do this, I would like to set the download and href attribute of the modebar button itself. But this is inconvenient when using the “modeBarButtonsToAdd” function because I guess the element is not created yet.
What I can do is afterwards add a button myself manually, but this is ugly. Is there anyway to do this using modeBarButtonsToAdd function provided by the plotly.js api?
My final goal is actually to save the plot as a html file. Thus given a plot with id, then the button a attribution should have
a.setAttribute("href ", “data:text/html,” + document.getElementById(id).innerHTML);