Learn R Programming

shinydlplot (version 0.1.4)

downloadablePlotlyUI: UI for plotly with download data button in modebar

Description

UI for plotly with download data button in modebar

Usage

downloadablePlotlyUI(id, width = "100%", height = "auto", inline = FALSE)

Value

an HTML tag object corresponding to the UI for downloadablePlotly.

Arguments

id

id string that gets namespaced by shiny::NS.

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. Note that, for height, using "auto" or "100%" generally will not work as expected, because of how height is computed with HTML/CSS.

inline

use an inline (span()) or block container (div()) for the output

See Also

NS, downloadablePlotly

Examples

Run this code
library(shiny)
library(shinyjs)
library(shinydlplot)
library(plotly)
ui <- fluidPage(
  useShinyjs(),
  downloadablePlotlyUI(id = 'iris')
)
server <- function(input, output, session) {

  plot <- plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)

  callModule(downloadablePlotly,
             id = 'iris',
             plot = plot,
             filename = 'iris.csv',
             content = function(file) {write.csv(iris, file)})
}

if (FALSE) shinyApp(ui, server)

Run the code above in your browser using DataLab