Как добавить всплывающие подсказки к HTML-виджетам в блестящей панели инструментов - PullRequest
0 голосов
/ 16 мая 2018

Я изо всех сил пытаюсь добавить всплывающие подсказки к HTML-виджетам в Rshiny.bs_embed_tooltip из library(flexdashboard) выполняет работу для некоторых блестящих виджетов, но возвращает следующую ошибку, когда она применяется к 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)

Ваша помощь в обходе кода в комментарии будет высоко ценится.

1 Ответ

0 голосов
/ 17 мая 2018

Попробуйте использовать этот новый блок для измерительного блока:

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