downloadablePlotUI: downloadablePlot UI

Description Usage Arguments Example Notes Shiny Usage See Also Examples

View source: R/downloadablePlot.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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. The linked downloadfxns are set in the paired callModule (see the Shiny Usage section)

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 shiny::callModule(downloadablePlot, id, ...) in server.R

See Also

downloadablePlot

downloadFileButton

clickOpts

hoverOpts

brushOpts

Examples

1
2
3
4
5
6
# 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")

periscope documentation built on July 8, 2020, 7:18 p.m.