timezone argument fails in shiny but works in console
sanjmeh opened this issue · 1 comments
Hi Dean,
First of all thanks for this excellent package. I started using it today and ran into a possible bug.
This line works in shiny.
output$tline <- renderTimevis({
timevis(data.table(id = 1:6,content = c("Uplift 202L","Uplift 103L","Downlift 4500L","Uplift 450L","Downlift 2000L","Uplift 520L"),start = Sys.time() - hours(as.integer(rnorm(6,100,sd = 50)))))
})
But if I run the same line with the arrgument timezone
added, it fails. Following is a little more context form the shiny app.
Loaded packages:
pacman::p_load(futile.logger,shiny,shinyalert,shinybrowser,plotly,shinydashboard,tidyverse,lubridate,data.table,
fontawesome, shinyWidgets, gt, shinycssloaders,timevis)
extract of ui:
tabItem(tabName = "timeline",
box(width = 12, title = "Time Line",status = "success",solidHeader = T,
selectizeInput("tanktline","Island Name",choices = vehdt$veh,width = "20%"),
timevisOutput("tline") |> withSpinner()
)
)....
extract of server function:
output$tline <- renderTimevis({
timevis(data.table(id = 1:6,content = c("Uplift 202L","Uplift 103L","Downlift 4500L","Uplift 450L","Downlift 2000L","Uplift 520L"),start = Sys.time() - hours(as.integer(rnorm(6,100,sd = 50)))),timezone = 5)
})
The output timeline is a static and distorted image.
However, this works in the console:
timevis(data.table(id = 1:6,content = c("Uplift 202L","Uplift 103L","Downlift 4500L","Uplift 450L","Downlift 2000L","Uplift 520L"),start = Sys.time() - hours(as.integer(rnorm(6,100,sd = 50)))),timezone = 5)
As a summary,
when I remove the timezone
argument, the shiny app works else it results in a bad output.
I'm not able to reproduce an issue.
The code you provided is not reproducible so I modfiied it a little bit but I've been unable to see a problem. Here is a shiny app using the same timevis data you provided and using a timezone, and it works.
library(shiny)
library(timevis)
library(lubridate)
ui <- fluidPage(
timevisOutput("test")
)
server <- function(input, output, session) {
output$test <- timevis::renderTimevis({
timevis(
data.frame(
id = 1:6,
content = c("Uplift 202L","Uplift 103L","Downlift 4500L","Uplift 450L","Downlift 2000L","Uplift 520L"),
start = Sys.time() - hours(as.integer(rnorm(6,100,sd = 50)))
),
timezone = 5
)
})
}
shinyApp(ui, server)
I'm closing this issue for now. If you still believe there's a problem, please post a minimal fully reproducible example.