I need to add tooltips to the tabs "Plot", "Summary" and "table". For this purpose, I have used bsTooltip function. But it is not working here.
library(shiny)
library(shinyBS)
ui <- fluidPage(
titlePanel("Tabsets"),
sidebarLayout(
conditionalPanel(
'input.dataset === "Plot"',
radioButtons("dist", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp")),br(),
sliderInput("n",
"Number of observations:",
value = 500,
min = 1,
max = 1000)),
mainPanel(
tabsetPanel(id = 'dataset',
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Table", tableOutput("table"))))),
bsTooltip("Plot", "Information", placement = "bottom", trigger = "hover",
options = NULL),
bsTooltip("Table", "Table Summary", placement = "bottom", trigger = "hover",
options = NULL),
bsTooltip("Summary", "Summary", placement = "bottom", trigger = "hover",
options = NULL),)
server <- function(input, output)
{
d <- reactive({
dist <- switch(input$dist,
norm = rnorm,
unif = runif,
lnorm = rlnorm,
exp = rexp,
rnorm)
dist(input$n)
})
output$plot <- renderPlot({
dist <- input$dist
n <- input$n
hist(d(),
main = paste("r", dist, "(", n, ")", sep = ""),
col = "#75AADB", border = "white")
})
output$summary <- renderPrint({
summary(d())})
output$table <- renderTable({
d()})}
shinyApp(ui, server)
If I change the bsTooltip ID to dataset it will work but not as expected
Is there any other way to do this ?