Description Usage Arguments Examples
Move the window such that given item or items are centered
1 | centerItem(id, itemId, options)
|
id |
Timeline id or a |
itemId |
A vector (or single value) of the item ids to center |
options |
Named list of options controlling mainly the animation.
Most common option is |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | timevis(data.frame(
id = 1:3,
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(
timevisOutput("timeline"),
actionButton("btn", "Center around item 1")
),
server = function(input, output) {
output$timeline <- renderTimevis(
timevis(
data.frame(id = 1:3,
start = c(Sys.Date() - 1, Sys.Date(), Sys.Date() + 1),
content = c("Item 1", "Item 2", "Item 3"))
)
)
observeEvent(input$btn, {
centerItem("timeline", 1)
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.