timevis-shiny | R Documentation |
Output and render functions for using timevis within Shiny applications and interactive Rmd documents.
timevisOutput(outputId, width = "100%", height = "auto") renderTimevis(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height |
Must be a valid CSS unit (like |
expr |
An expression that generates a timevis |
env |
The environment in which to evaluate |
quoted |
Is |
timevis
.
if (interactive()) { library(shiny) #----------------------- Most basic example ----------------- shinyApp( ui = fluidPage(timevisOutput("timeline")), server = function(input, output) { output$timeline <- renderTimevis( timevis() ) } ) #----------------------- More advanced example ----------------- data <- data.frame( id = 1:3, start = c("2015-04-04", "2015-04-05 11:00:00", "2015-04-06 15:00:00"), end = c("2015-04-08", NA, NA), content = c("<h2>Vacation!!!</h2>", "Acupuncture", "Massage"), style = c("color: red;", NA, NA) ) ui <- fluidPage( timevisOutput("appts"), div("Selected items:", textOutput("selected", inline = TRUE)), div("Visible window:", textOutput("window", inline = TRUE)), tableOutput("table") ) server <- function(input, output) { output$appts <- renderTimevis( timevis( data, options = list(editable = TRUE, multiselect = TRUE, align = "center") ) ) output$selected <- renderText( paste(input$appts_selected, collapse = " ") ) output$window <- renderText( paste(input$appts_window[1], "to", input$appts_window[2]) ) output$table <- renderTable( input$appts_data ) } shinyApp(ui, server) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.