【发布时间】:2016-07-25 14:20:39
【问题描述】:
我开始为我的 UI 和服务器使用闪亮的模块。我对 dygraph 图例的显示有一个特定的问题。
在使用闪亮的模块之前,我可以在我的 UI 中显示图表和图例。一旦我使用了这些模块,它就停止了工作。难道dygraph的传说不是反应输出?
没有闪亮的模块(有效)
...
tabPanel("Plot",dygraphOutput("plot1"),
textOutput("legendDivID"))
...
dygraph 服务器代码:
output$plot1 <- renderDygraph({
dygraph(dfplot())%>%
dyLegend(labelsDiv = "legendDivID", labelsSeparateLines = T)%>%
dyRangeSelector()
})
现在我构建闪亮的模块
StockUI<-function(id, label= "aaa"){
ns <- NS(id)#Named space
...
tabPanel("Plot",dygraphOutput(ns("plot1")),
textOutput(ns("legendDivID"))}
Stock <- function(input,output,session){
...
output$plot1 <- renderDygraph({dygraph(foo())%>%
dyLegend(labelsDiv = "legendDivID", labelsSeparateLines = T)%>%
dyRangeSelector()
})
}
但是 Legend 不再显示,它在闪亮的模块之外工作正常。
【问题讨论】: