if (FALSE) {
linevis(data.frame(
start = c(Sys.Date() - 1, Sys.Date(), Sys.Date() + 1),
content = c("Item 1", "Item 2", "Item 3"))
) %>%
centerItem(1)
}
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
linevisOutput("graph2d"),
actionButton("btn", "Center around item 1")
),
server = function(input, output) {
output$graph2d <- renderLinevis(
linevis(
data.frame(
start = c(Sys.Date() - 1, Sys.Date(), Sys.Date() + 1),
content = c("Item 1", "Item 2", "Item 3"))
)
)
observeEvent(input$btn, {
centerItem("graph2d", 1)
})
}
)
}
Run the code above in your browser using DataLab