Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

242
Views
¿Cómo renderizo la salida (por ejemplo, gráficos) en diferentes navegadores/pestañas escritas personalizadas en una aplicación brillante?

Me gustaría construir algo que iguale la funcionalidad de las funciones brillantes navbarPage() y navbarMenu(). Sin embargo, cuando creo dos pestañas diferentes (NAVONE y NAVTWO en mi aplicación a continuación), puedo mostrar la salida dentro de la primera pestaña (que no está oculta de manera predeterminada), pero no puedo mostrar la salida dentro de la segunda pestaña. No me queda claro qué difiere entre ambas secciones de contenido.

 library(shiny) if (interactive()) { options(device.ask.default = FALSE) ui = fluidPage( ###NAVBAR tags$div(class = 'nav', tags$button('NAVONE', class = 'navlinks', id = "defaultOpenNav", onclick = 'openNav(event, "NAVONE")'), tags$button('NAVTWO', class = 'navlinks', onclick = 'openNav(event, "NAVTWO")')), ###NAVCONTENT tags$div(class = 'navcontent', id = 'NAVONE', actionLink(inputId = "actnOne", "click to create plot for nav one"), plotOutput(outputId = "plotOne")), tags$div(class = 'navcontent', id = 'NAVTWO', actionLink(inputId = "actnTwo", "click to create plot for nav two"), plotOutput(outputId = "plotTwo")), ###JAVASCRIPT tags$script(HTML( "function openNav(evt, NavToOpen) { // Declare all variables var i, navcontent, navlinks; // Get all elements with class = 'navcontent' and hide them navcontent = document.getElementsByClassName('navcontent'); for (i = 0; i < navcontent.length; i++) { navcontent[i].style.display = 'none'; } // Get all elements with class = 'tablinks' and remove the class 'active' document.getElementById(NavToOpen).style.display = 'block'; evt.currentTarget.className += ' active'; } // navcontent to be open by default document.getElementById('defaultOpenNav').click();" )) ) server = function(input, output, session){ ###PLOT FOR NAV ONE observeEvent(input$actnOne, { output$plotOne = renderPlot({ hist(iris$Sepal.Length) }) }) ###PLOT FOR NAV TWO observeEvent(input$actnTwo, { output$plotTwo = renderPlot({ hist(iris$Sepal.Length) }) }) } shinyApp(ui, server) }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!