![](/img/trans.png)
[英]The downloadablePlot shiny module is not displayed in a shiny app
[英]The downloadablePlot Shiny Module breaks down my shiny app upon launching
我有下面的shiny
应用程序,我想知道如何使用downloadablePlot
Shiny 模块下载 plot。 当我启动该应用程序时,整个应用程序都崩溃了。
library(shiny)
library(periscope)
ui <- fluidPage(
plotOutput("plot"),
downloadablePlotUI("object_id1",
downloadtypes = c("png", "csv"),
download_hovertext = "Download the plot and data here!",
height = "500px",
btn_halign = "left")
)
server <- function(input, output) {
output$plot<-renderPlot(plot(iris))
plotInput = function() {
plot(iris)
}
callModule(downloadablePlot,
"object_id1",
logger = ss_userAction.Log,
filenameroot = "mydownload1",
aspectratio = 1.33,
downloadfxns = list(png = plotInput()),
visibleplot = plotInput())
}
shinyApp(ui = ui, server = server)
将 plotInput 作为参数传递时,尝试删除plotInput
之后的括号
library(shiny)
library(periscope)
ui <- fluidPage(
plotOutput("plot"),
downloadablePlotUI("object_id1",
downloadtypes = c("png", "csv"),
download_hovertext = "Download the plot and data here!",
height = "500px",
btn_halign = "left")
)
server <- function(input, output) {
output$plot<-renderPlot(plot(iris))
plotInput = function() {
plot(iris)
}
callModule(downloadablePlot,
"object_id1",
logger = ss_userAction.Log,
filenameroot = "mydownload1",
aspectratio = 1.33,
downloadfxns = list(png = plotInput),
visibleplot = plotInput)
}
shinyApp(ui = ui, server = server)
在 shiny 中,当传递函数/反应时,你通常需要避免在它们后面附加()
,因为这样做会评估它们。 在上面的示例中,您返回的是plotInput的 output 而不是 function 本身
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.