podpowiedź na błyszczącym R?
Chcę mieć podpowiedź w moim Shiny
R
podanie. Czy jest jakiś łatwy sposób, aby to osiągnąć? Na razie tworzę mapę gęstości i chcę prostą podpowiedź pokazującą "kliknij tutaj, aby przesuwać lata", najeżdżając kursorem myszy na rok suwaka.
Interfejs Użytkownika:
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%")
)
))
Kod Serwera:
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)
})
})
Dzięki za pomoc. 44
2 answers
Myślę, że powinieneś być w stanie zastąpić to:
sliderInput("slider_year", "YEAR:",
min = 2001, max = 2011, value = 2009,
format="####", locale="us"
)
Z tym:
tags$div(title="Click here to slide through years",
sliderInput("slider_year", "YEAR:",
min = 2001, max = 2011, value = 2009,
format="####", locale="us"
)
)
51
Author: Joe Cheng,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-05-08 22:58:08
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-05-08 22:58:08
Jest to nieco łatwiejszy i bardziej elegancki sposób.
library(shinyBS) # Additional Bootstrap Controls
## From ui.R: Adds a tooltip to element with inputId = "someInput"
## with text, "This is an input.", that appears to the left on hover.
bsTooltip(id = "someInput", title = "This is an input",
placement = "left", trigger = "hover")
## From server.R: Add the same tooltip as above
addTooltip(session, id = "someInput", title = "This is an input.",
placement = "left", trigger = "hover")
Możesz dodać podpowiedź w ui.R
lub server.R
,
Dodatkowe można również użyć Popover.
39
Author: Praneeth Jagarapu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-08-23 15:20:52
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-08-23 15:20:52