mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
renderCachedPlot: pass ... args
This commit is contained in:
@@ -133,6 +133,7 @@
|
||||
renderCachedPlot <- function(expr, cacheKeyExpr, cacheResetEventExpr = NULL,
|
||||
baseWidth = 400, aspectRatioRate = 1.2, growthRate = 1.2, res = 72,
|
||||
scope = "app",
|
||||
...,
|
||||
env = parent.frame(), quoted = FALSE, outputArgs = list()
|
||||
) {
|
||||
|
||||
@@ -143,6 +144,8 @@ renderCachedPlot <- function(expr, cacheKeyExpr, cacheResetEventExpr = NULL,
|
||||
# triggered by the cache key (or width/height) changing.
|
||||
isolatedFunc <- function() isolate(func())
|
||||
|
||||
args <- list(...)
|
||||
|
||||
cacheKey <- reactive(substitute(cacheKeyExpr), env = parent.frame(), quoted = TRUE)
|
||||
|
||||
.cacheDir <- NULL
|
||||
@@ -271,8 +274,19 @@ renderCachedPlot <- function(expr, cacheKeyExpr, cacheResetEventExpr = NULL,
|
||||
} else {
|
||||
cat("drawReactive(): drawPlot()\n")
|
||||
# This includes the displaylist.
|
||||
drawPlot(outputName, session, isolatedFunc, width, height, pixelratio, res,
|
||||
resultfile = resultFilePath)
|
||||
do.call("drawPlot", c(
|
||||
list(
|
||||
name = outputName,
|
||||
session = session,
|
||||
func = isolatedFunc,
|
||||
width = width,
|
||||
height = height,
|
||||
pixelratio = pixelratio,
|
||||
res = res,
|
||||
resultfile = resultFilePath
|
||||
),
|
||||
args
|
||||
))
|
||||
}
|
||||
},
|
||||
catch = function(reason) {
|
||||
@@ -343,9 +357,19 @@ renderCachedPlot <- function(expr, cacheKeyExpr, cacheResetEventExpr = NULL,
|
||||
|
||||
} else {
|
||||
cat("renderFunc(): resizeSavedPlot()\n")
|
||||
img <- resizeSavedPlot(name, shinysession, result,
|
||||
width, height, pixelratio, res,
|
||||
resultfile = resultFilePath)
|
||||
img <- do.call("resizeSavedPlot", c(
|
||||
list(
|
||||
name,
|
||||
shinysession,
|
||||
result,
|
||||
width,
|
||||
height,
|
||||
pixelratio,
|
||||
res,
|
||||
resultfile = resultFilePath
|
||||
),
|
||||
args
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
\usage{
|
||||
renderCachedPlot(expr, cacheKeyExpr, cacheResetEventExpr = NULL,
|
||||
baseWidth = 400, aspectRatioRate = 1.2, growthRate = 1.2, res = 72,
|
||||
scope = "app", env = parent.frame(), quoted = FALSE,
|
||||
scope = "app", ..., env = parent.frame(), quoted = FALSE,
|
||||
outputArgs = list())
|
||||
}
|
||||
\arguments{
|
||||
@@ -38,6 +38,9 @@ smaller and larger.}
|
||||
\code{"session"}, or the path to a directory to store cached plots. See the
|
||||
Cache Scoping section for more information.}
|
||||
|
||||
\item{...}{Arguments to be passed through to \code{\link[grDevices]{png}}.
|
||||
These can be used to set the width, height, background color, etc.}
|
||||
|
||||
\item{env}{The environment in which to evaluate \code{expr}.}
|
||||
|
||||
\item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This
|
||||
|
||||
Reference in New Issue
Block a user