tooltip on shiny R? -
i want have tool-tip in shiny r application. there easy way achieve that? now, creating density map , want simple tool-tip showing "click here slide through years" while hovering mouse on slider year.
user interface:
library(shiny) shinyui(pagewithsidebar( headerpanel("density map"), sidebarpanel( sliderinput("slider_year", "year:", min = 2001, max = 2011, value = 2009, format="####", locale="us" ) ) ), mainpanel( plotoutput("event_heatmap_map", width = "100%", height = "100%") ) ))
server code:
library(shiny) library(ggmap) library(ggplot2) mydata <- read.csv("/var/shiny-server/www/dmetrics.csv") shinyserver(function(input, output) { output$event_heatmap_map <- renderplot(width = "auto", height = 640,{ slice_year <- mydata[mydata$year==input$slider_year,] map <- get_map(c(lon = -55.3632715, lat = 31.7632836), zoom = 3, source = 'google', maptype = c("terrain"), messaging = false, color = 'color') world <- ggmap(map) world <- world + stat_density2d(data = slice_year, aes(x = west, y = north, fill = ..level.., alpha = ..level..), show_guide = false, geom = "polygon", na.rm = true) + scale_fill_gradient(name="density", low="maroon", high="yellow", guide = 'colorbar') plot(world) }) })
thanks help.
i think should able replace this:
sliderinput("slider_year", "year:", min = 2001, max = 2011, value = 2009, format="####", locale="us" )
with this:
tags$div(title="click here slide through years", sliderinput("slider_year", "year:", min = 2001, max = 2011, value = 2009, format="####", locale="us" ) )
Comments
Post a Comment