首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >conditionalPanel和selectInput

conditionalPanel和selectInput
EN

Stack Overflow用户
提问于 2017-01-31 15:58:58
回答 1查看 2.1K关注 0票数 2

这是我的问题;我无法正确地设置conditionalPanel来使用selectInput。我需要的是在"AP LIGUA“被选中的时候,在选择lascruzadas时,用lascruzadas来绘制。但闪亮是绘制这两幅图的时候。

救命啊..。

服务器中的

代码语言:javascript
复制
vars <- data.frame(location = c("AP LIGUA",
                              "LAS CRUZADAS"),
                 lat = c(-32.45,
                         -32.183333),
                 lon = c(-71.216667,
                         -70.802222)
)

output$apligua <- renderPlotly({
 theme_set(theme_bw()) 
 ggplot(aes(x = datos2$horafecha, y = datos2$altura2), data = datos2) + 
   geom_line() +
   geom_point() +
   geom_smooth(method = "auto", colour='blue', span=0.2) +
   ylab("Altura (m) ") + 
   xlab("Meses")
})

output$lascruzadas <- renderPlotly({
 theme_set(theme_bw()) 
 ggplot(aes(x = datos$horafecha, y = datos$altura2), data = datos) + 
   geom_line() +
   geom_point() +
   geom_smooth(method = "auto", colour='blue', span=0.2) +
   ylab("Altura (m) ") + 
   xlab("Meses")
})

UI中的

代码语言:javascript
复制
selectInput(inputId = "myLocations", label = "Estación",
                                              choices = vars$location),

conditionalPanel("input.myLocations" == "LAS CRUZADAS",
                                plotlyOutput("lascruzadas", height = "100%")
                                ),

conditionalPanel("input.myLocations" == "AP LIGUA",
                                plotlyOutput("apligua", height ="100%")
                                )

(错误编辑)

EN

回答 1

Stack Overflow用户

发布于 2017-01-31 16:03:00

您的条件应该是Javascript代码的一个字符串。所以,就像:

代码语言:javascript
复制
"input.myLocations == 'LAS CRUZADAS'"

注意单引号。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41961926

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档