plotly动画无法在闪亮的应用程序中工作?

问题描述 投票:0回答:1

我曾尝试在闪亮的应用程序中使用ploty,但事实证明,相同的plotly在本地可以运行,但是在闪亮的应用程序中部署时启动失败,该应用程序仅显示空白。此代码在本地有效,

   plot_ly(caseonly,
        x = ~  cases,
        y = ~ county,
        frame = ~ date,
        type = "scatter",
        mode = "markers"
    ) %>%
     layout(showlegend = TRUE) %>%
    animation_opts(frame = 100, redraw = FALSE)

但是,当我将代码卡盘放入一个闪亮的应用程序中时,它会返回空白页?有任何提示吗?

一个闪亮的示例应用程序。

    header <- dashboardHeader()
    sidebar <- dashboardSidebar(selectInput("County", "Please select:", c("King" = 0, "Queen" = 1)))

    body <- dashboardBody(box(width = 14, plotlyOutput(outputId = "DI")))

    # UI
    ui <- dashboardPage(
      skin = "blue",
      header=header,
      sidebar=sidebar,
      body = body
    )


    # SERVER
    server <- function(input, output) {
     output$DI <- renderPlotly({
     plot_ly(caseonly,
        x = ~  cases,
        y = ~ county,
        frame = ~ date,
        type = "scatter",
        mode = "markers"
     ) %>%
     layout(showlegend = TRUE) %>%
     animation_opts(frame = 100, redraw = FALSE)
      })
     }

     shinyApp(ui = ui, server = server)

这是我正在使用的数据集:

        > dput(head(caseonly,n=60))
structure(list(fips = c(1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 
1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L, 1073L
), county = c("Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County", "Jefferson County", "Jefferson County", "Jefferson County", 
"Jefferson County"), state = c("AL", "AL", "AL", "AL", "AL", 
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", 
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", 
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", 
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", 
"AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL"
), date = c("1/22/2020", "1/23/2020", "1/24/2020", "1/25/2020", 
"1/26/2020", "1/27/2020", "1/28/2020", "1/29/2020", "1/30/2020", 
"1/31/2020", "2/1/2020", "2/10/2020", "2/11/2020", "2/12/2020", 
"2/13/2020", "2/14/2020", "2/15/2020", "2/16/2020", "2/17/2020", 
"2/18/2020", "2/19/2020", "2/2/2020", "2/20/2020", "2/21/2020", 
"2/22/2020", "2/23/2020", "2/24/2020", "2/25/2020", "2/26/2020", 
"2/27/2020", "2/28/2020", "2/29/2020", "2/3/2020", "2/4/2020", 
"2/5/2020", "2/6/2020", "2/7/2020", "2/8/2020", "2/9/2020", "3/1/2020", 
"3/10/2020", "3/11/2020", "3/12/2020", "3/13/2020", "3/14/2020", 
"3/15/2020", "3/16/2020", "3/17/2020", "3/18/2020", "3/19/2020", 
"3/2/2020", "3/20/2020", "3/21/2020", "3/22/2020", "3/23/2020", 
"3/24/2020", "3/25/2020", "3/26/2020", "3/27/2020", "3/28/2020"
), cases = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 
5L, 12L, 17L, 21L, 25L, 34L, 0L, 50L, 61L, 71L, 86L, 91L, 129L, 
169L, 179L, 214L), deaths = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L), BedLicensed = c(4473L, 4473L, 4473L, 4473L, 
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 
4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 4473L, 
4473L, 4473L), TotPop = c(659892L, 659892L, 659892L, 659892L, 
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 
659892L, 659892L, 659892L, 659892L, 659892L, 659892L, 659892L
), rate = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), 
    deathrate = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
    0L, 0L, 0L, 0L)), row.names = c(NA, 60L), class = "data.frame")```

shiny plotly
1个回答
0
投票

感谢éphaneLaurent的提示,我尝试更改默认浏览器,现在它显示了!

© www.soinside.com 2019 - 2024. All rights reserved.