Shiny 如何在闪亮的仪表板中向html小部件添加工具提示

Shiny 如何在闪亮的仪表板中向html小部件添加工具提示,shiny,shinydashboard,Shiny,Shinydashboard,我正在努力为Rshiny中的html小部件添加工具提示。libraryflexdashboard中的bs_embed_工具提示用于某些闪亮的小部件,但在应用于html小部件时返回以下错误: Error in .tag_validate(.) : tag is not a shiny.tag - tag must be generated using htmltools or shiny 下面是我修改shinydashboard示例代码的最简单的工作示例: ## app.R ## libr

我正在努力为Rshiny中的html小部件添加工具提示。libraryflexdashboard中的bs_embed_工具提示用于某些闪亮的小部件,但在应用于html小部件时返回以下错误:

Error in .tag_validate(.) : 
  tag is not a shiny.tag - tag must be generated using htmltools or shiny
下面是我修改shinydashboard示例代码的最简单的工作示例:

## app.R ##
library(shinydashboard)
library(flexdashboard)
library(bsplus) # For shiny tooltips

ui <- dashboardPage(
  dashboardHeader(title = "Basic dashboard"),
  dashboardSidebar(),
  dashboardBody(
    # Boxes need to be put in a row (or column)
    fluidRow(
      box(plotOutput("plot1", height = 250) %>%
            bs_embed_tooltip("This is the output chart.", placement = 'bottom')
      ),

      box(title = "Controls",
          sliderInput("slider", "Number of observations:", 1, 100, 50) %>%
            bs_embed_tooltip("Use this slider to select the number of observations.", placement = 'bottom')
      ),
      box(title = "Guage",
          gaugeOutput("guage_value") # %>% bs_embed_tooltip("This gauge shows the input value from the slider.", placement = 'bottom')
      )
    )
  )
)

server <- function(input, output) {
  set.seed(122)
  histdata <- rnorm(500)

  output$plot1 <- renderPlot({
    data <- histdata[seq_len(input$slider)]
    hist(data)
  })

  output$guage_value <- renderGauge({

    gauge(input$slider, min = 0, max = 100, symbol = '', gaugeSectors(
      danger = c(0, 30), warning = c(31, 70), success = c(71, 100) ))

  })
}

shinyApp(ui, server)

如果您能帮助我们绕过注释中的代码,我们将不胜感激。

请尝试使用此新的仪表箱:

  box(title = "Guage",
      gaugeOutput("guage_value"),
      bsTooltip(id = "guage_value", title = "This gauge shows the input value from the slider.", placement = "bottom")
  )

这段代码对我来说没有错误,工具提示显示在它们放置的位置。我需要显示关于GaugeOutGuage_值的工具提示。请关闭注释中的代码段。