if (FALSE) {
timevis(
data.frame(start = Sys.Date(), content = "Today"),
options = list(showCurrentTime = FALSE, orientation = "top")
) %>%
setOptions(list(editable = TRUE, showCurrentTime = TRUE))
}
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
timevisOutput("timeline"),
actionButton("btn", "Show current time and allow items to be editable")
),
server = function(input, output) {
output$timeline <- renderTimevis(
timevis(
data.frame(start = Sys.Date(), content = "Today"),
options = list(showCurrentTime = FALSE, orientation = "top")
)
)
observeEvent(input$btn, {
setOptions("timeline", list(editable = TRUE, showCurrentTime = TRUE))
})
}
)
}
Run the code above in your browser using DataLab