[英]The downloadablePlot Shiny Module breaks down my shiny app upon launching
I have the shiny
app below and I would like to know how I can download a plot using the downloadablePlot
Shiny Module.我有下面的
shiny
应用程序,我想知道如何使用downloadablePlot
Shiny 模块下载 plot。 When I launch the app the whole app breaks down.当我启动该应用程序时,整个应用程序都崩溃了。
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)
Try removing the brackets after plotInput
when passing it as an argument将 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)
In shiny, when passing functions / reactives around, you usually need to avoid appending them with ()
as doing so evaluates them.在 shiny 中,当传递函数/反应时,你通常需要避免在它们后面附加
()
,因为这样做会评估它们。 In the above example, you were returning the output of plotInput instead of the function itself在上面的示例中,您返回的是plotInput的 output 而不是 function 本身
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.