Skip to content

Commit 7f519a9

Browse files
committed
document and clean-up
1 parent 80f98a2 commit 7f519a9

File tree

2 files changed

+18
-45
lines changed

2 files changed

+18
-45
lines changed

R/partial_bundles.R

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#' Use a partial bundle of plotly.js
22
#'
3+
#' Leveraging plotly.js' partial bundles can lead to smaller file sizes
4+
#' and faster rendering. The full list of available bundles, and the
5+
#' trace types that they support, are available [here](https://github.com/plotly/plotly.js/blob/master/dist/README.md)
36
#'
47
#' @param p a plotly object.
5-
#' @param type name of the (partial) bundle. The default `'auto'` attempts to
6-
#' @param version version number (e.g. 1.30.0). See [here](https://github.com/plotly/plotly.js/releases)
7-
#' for a list of valid versions and changelogs.
8-
#' @param local either "local", "cdn", or "rawgit".
8+
#' @param type name of the (partial) bundle. The default, `'auto'`, attempts to
9+
#' find the smallest single bundle that can render `p`. If no single partial bundle,
10+
#' can render `p`, then the full bundle is used.
11+
#' @param local whether or not to download the partial bundle so that it can be
12+
#' viewed later without an internet connection.
913
#' @param minified whether or not to use a minified js file (non-minified file can be useful for debugging plotly.js)
10-
#' @export
1114
#' @author Carson Sievert
12-
#' @references <https://github.com/plotly/plotly.js/blob/master/dist/README.md>
13-
#' @seealso `[plotly_bundle_info]()`
14-
#'
15+
#' @export
1516
#' @examples
1617
#'
1718
#' library(plotly)
@@ -129,8 +130,7 @@ plotlyjsBundle <- function(p) {
129130
p$dependencies[[plotlyjsBundleIDX(p)]]
130131
}
131132

132-
133-
# TODO: create this object from the dist/README.md
133+
# TODO: create this object in inst/plotlyjs.R from the dist/README.md
134134
bundleTraceMap <- list(
135135
basic = c(
136136
"scatter",
@@ -184,26 +184,3 @@ bundleTraceMap <- list(
184184
"candlestick"
185185
)
186186
)
187-
188-
189-
190-
##' List trace types supported by a particular bundle
191-
##'
192-
##' @export
193-
#partial_bundle_info <- function() {
194-
# for (i in seq_along(bundle_traces)) {
195-
# bundle_name <- names(bundle_traces)[[i]]
196-
# msg <- sprintf(
197-
# "The '%s' bundle size is %s MB and contains the '%s' traces",
198-
# bundle_name,
199-
# round(file.info(bundle_file(bundle_name))$size / 1000000, 3),
200-
# paste(bundle_traces[[i]], collapse = "', '")
201-
# )
202-
# message(msg)
203-
# }
204-
#}
205-
#
206-
#bundle_file <- function(bundle = "basic") {
207-
# bundle <- match.arg(bundle, names(bundle_traces))
208-
# system.file("lib", paste0("plotly-", bundle, ".min.js"), package = "plotlyDepends")
209-
#}

man/partial_bundle.Rd

Lines changed: 8 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)