linevis-shiny {linevis}R Documentation

Shiny bindings for linevis

Description

Output and render functions for using linevis within Shiny applications and interactive Rmd documents.

Usage

linevisOutput(outputId, width = "100%", height = "auto")

renderLinevis(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

width, height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended. height will probably not have an effect; instead, use the height parameter in linevis.

expr

An expression that generates a linevis

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.

Value

Htmlwidgets render and output objects

See Also

linevis.

Examples

if (interactive()) {
library(shiny)

#----------------------- Most basic example -----------------
shinyApp(
  ui = fluidPage(linevisOutput("graph2d")),
  server = function(input, output) {
    output$graph2d <- renderLinevis(
      linevis()
    )
  }
)


#----------------------- More advanced example -----------------
df_data = data.frame(x = c('2014-06-11',
                           '2014-06-12',
                           '2014-06-13',
                           '2014-06-14',
                           '2014-06-15',
                           '2014-06-16'),
                     y = c(0,
                           1,
                           30000,
                           10,
                           150,
                           30000,
                           20,
                           20))

ui <- fluidPage(
  linevisOutput("appts"),
  div("Visible window:", textOutput("window", inline = TRUE)),
  tableOutput("table")
)

server <- function(input, output) {
  output$appts <- renderLinevis(
    linevis(df_data)
  )

  output$window <- renderText(
    paste(input$appts_window[1], "to", input$appts_window[2])
  )

  output$table <- renderTable(
    input$appts_data
  )
}
shinyApp(ui, server)
}


[Package linevis version 1.0.0 Index]