I'm trying to get tooltips working with a package called ggtips.
(Found here)
I've done my best to read the documentation and play around (mirroring the working demo file), but I cannot get seemingly simple tooltips to work.
Here is a basic example:
library(tidyverse)
library(ggtips)
library(shiny)
test <- tibble(name = c("bob", "anna", "musa"),
duration = c(14, 22, 19)
)
ui <- fluidPage(
# Application title
titlePanel("ggtips test"),
mainPanel(
uiOutput("timePlot")
)
)
server <- function(input, output) {
output$timePlot <- renderUI({
server <- function(input, output) {
output$timePlot <- renderUI({
plot = ggplot(data = test) +
aes(
x = name,
y = duration,
colour = name,
fill = name) +
geom_boxplot()
varDict = (structure("Name", names = "name"))
ggtips::plotWithTooltips(plot, varDict = varDict)
})}
# Run the application
shinyApp(ui = ui, server = server)
The above varDict mirrors the included demo, but I've also tried the code below, which follows the documentation:
server <- function(input, output) {
output$timePlot <- renderUI({
plot = ggplot(data = test) +
aes(
x = name,
y = duration,
colour = name,
fill = name) +
geom_boxplot()
ggtips::plotWithTooltips(plot, varDict = list(name = "Name"))
})}
Any help is greatly appreciated.