2

I've gathered that I need to use shinyjs and extendShinyjs, so here's what I have so far:

in ui.R outside of the ui function:

js_reset_axes <- "shinyjs.reset_axes = function(){ }"

inside the ui function:

extendShinyjs(text = js_reset_axes, functions = c("reset_axes"))

and in the server function:

js$reset_axes()

I don't really know js syntax, but I know I have to fill the ui.R function with the mode bar button location and indicate I want it clicked. I gather this is the location for the reset axes button:

<a rel="tooltip" class="modebar-btn" data-title="Reset axes" data-attr="zoom" data-val="reset" data-toggle="false" data-gravity="n">

What's the correct js syntax to have it clicked?

There are multiple elements with the same classname so I'd have to specify using the data-title or data-val identifier. Alternatively, it is possible to remove all other elements and just leave the one I'm interested in using.

enter image description here enter image description here

1 Answer 1

2

I'd suggest this, since you want to select the fouth element with a classname : .modebar-btn:

document.querySelectorAll('.modebar-btn')[3].click();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.