问题
I'm trying to build an app, which is doing something similar to this post. I want point coordinates to be copied to a clipboard by every click. I've just copied it as an example with a small modification in observeEvent
.
library(shiny)
library(dygraphs)
library(clipr)
ui = fluidPage(
mainPanel(
dygraphOutput("dygraph"),
br(),
textOutput("clicked", inline = TRUE)
)
)
server = function(input, output) {
output$dygraph <- renderDygraph({
dygraph(ldeaths)
})
output$clicked <- renderText({
strftime(req(input$dygraph_click$x), "%d-%m-%Y")
})
clickedPr <- reactive({
print(strftime(req(input$dygraph_click$x), "%d-%m-%Y"))
})
observeEvent(req(input$dygraph_click$x),{
clipr::write_clip(clickedPr())
# write.table(clickedPr(), "clipboard", quote = F, row.names = F, col.names = F)
})
}
shinyApp(ui = ui, server = server)
It works perfect on my Windows machine. When I deploy my app with Shinyapps.io, I'm disconnected each time I want to use the copy-to-clipboard function. What's going on?
Here is the not-working example at shinyapps.io https://atsyplenkov.shinyapps.io/shiny-example/
来源:https://stackoverflow.com/questions/60281465/shinyapps-io-crashes-when-getting-point-coordinates-of-a-dygraph