我只想在我的閃亮R應用程序中有一個工具提示。有沒有簡單的方法來實現呢?現在,我正在創建一個密度映射,並且我想要一個簡單的工具提示,將鼠標懸停在滑塊YEAR上方,顯示「單擊此處滑動數年」。
用戶界面:
閃亮R上的工具提示?
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%")
)
))
服務器代碼:
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)
})
})
感謝您的幫助。
你能提供更多的信息嗎? http://stackoverflow.com/a/5963610/509782 – harkmug 2013-05-08 20:14:22