Learn R Programming

periscope (version 1.0.4)

downloadablePlotUI: downloadablePlot UI

Description

Creates a custom plot output that is paired with a linked downloadFile button. This module is compatible with ggplot2, grob and lattice produced graphics.

Usage

downloadablePlotUI(
  id,
  downloadtypes = c("png"),
  download_hovertext = NULL,
  width = "100%",
  height = "400px",
  btn_halign = "right",
  btn_valign = "bottom",
  btn_overlap = TRUE,
  clickOpts = NULL,
  hoverOpts = NULL,
  brushOpts = NULL
)

Arguments

id

character id for the object

downloadtypes

vector of values for download types

download_hovertext

download button tooltip hover text

width

plot width (any valid css size value)

height

plot height (any valid css size value)

btn_halign

horizontal position of the download button ("left", "center", "right")

btn_valign

vertical position of the download button ("top", "bottom")

btn_overlap

whether the button should appear on top of the bottom of the plot area to save on vertical space (there is often a blank area where a button can be overlayed instead of utilizing an entire horizontal row for the button below the plot area)

clickOpts

NULL or an object created by the clickOpts function

hoverOpts

NULL or an object created by the hoverOpts function

brushOpts

NULL or an object created by the brushOpts function

Example

downloadablePlotUI("myplotID", c("png", "csv"), "Download Plot or Data", "300px")

Notes

When there is nothing to download in any of the linked downloadfxns the button will be hidden as there is nothing to download.

This module is NOT compatible with the built-in (base) graphics (such as basic plot, etc.) because they cannot be saved into an object and are directly output by the system at the time of creation.

Shiny Usage

Call this function at the place in ui.R where the plot should be placed.

Paired with a call to downloadablePlot(id, ...) in server.R

See Also

downloadablePlot

downloadFileButton

clickOpts

hoverOpts

brushOpts

Examples

Run this code
# Inside ui_body.R or ui_sidebar.R
downloadablePlotUI("object_id1", 
                   downloadtypes = c("png", "csv"), 
                   download_hovertext = "Download the plot and data here!",
                   height = "500px", 
                   btn_halign = "left")

Run the code above in your browser using DataLab