Tuesday 29 November 2016

r - Adding hover tooltips to shinyapps.io



I would like to add hover tooltips to my input and output boxes on a shiny app that is deployed in shinyapps.io.



I found the RLumShiny package which can add tooltips and I have modified my app to accommodate this. The app works locally but when I try to deploy it to shinyapps.io I end up with the error seen below. There are no companion files to the app - just the ui.R and server.R files.



To deploy I run




library(rsconnect)
deployApp('~/sandbox/overdiag/', logLevel="verbose")


I get an error message




----- Deployment error -----




Error: C stack usage 7969336 is too close to the limit




(and a bunch of other information from the track). I've made a minimal example that produces the same error where the ui.R is



## ui.R ##                                                                                                                                                
library("shiny")
library("RLumShiny") ## This package is problematic
library("shinydashboard")
library("shinyWidgets")


dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody()
)


and server.R




library("shiny")
library("RLumShiny") ## Again this package
library("shinydashboard")

function(input, output, session) {

}


Now if I remove the library("RLumShiny") line then everything works fine and I can deploy it right away. I don't get information that the package is not available but maybe there is something else wrong (I have a nagging feeling that the javascript in the package might do some things that the shinyapps.io service does not like).




Now: is there an alternative approach (ie., some other package) to get hover tooltips on the shinyapps.io or can I do something else to get RLumShiny to work?


Answer



In general in shiny you can get tooltips by using tags$div in your ui.r to wrap your controls / outputs and giving it a title. So for example you could do:



tags$div(title="My tooltip", plotOutput(outputId="MyPlot"))


and you will get a tool tip. The same pattern works for controls.


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...