After some research, I've discovered that in order to achieve my goal, I need to incorporate shinyjs and extendShinyjs. Here's what I have implemented so far:
In the ui.R file, outside of the ui function:
js_reset_axes <- "shinyjs.reset_axes = function(){ }"
Within the ui function:
extendShinyjs(text = js_reset_axes, functions = c("reset_axes"))
And in the server function:
js$reset_axes()
Although I'm not familiar with JavaScript syntax, it is evident that I need to specify the location of the mode bar button in the ui.R function and indicate that it should be clicked. It seems like this code corresponds to the reset axes button location:
<a rel="tooltip" class="modebar-btn" data-title="Reset axes" data-attr="zoom" data-val="reset" data-toggle="false" data-gravity="n">
What is the correct JavaScript syntax to trigger a click on this element?
Given that there are multiple elements sharing the same classname, I may need to differentiate using the data-title or data-val identifier. Alternatively, I could remove all other elements and focus solely on the one that interests me.
https://i.sstatic.net/2dgDe.png https://i.sstatic.net/ju0VE.png