Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Description: Create interactive web graphics from 'ggplot2' graphs and/or a cust
URL: https://plotly-r.com, https://github.com/plotly/plotly.R, https://plotly.com/r/
BugReports: https://github.com/plotly/plotly.R/issues
Depends:
R (>= 3.2.0),
R (>= 3.5),
ggplot2 (>= 3.0.0)
Imports:
tools,
Expand Down Expand Up @@ -77,7 +77,7 @@ Suggests:
reticulate,
rsvg
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Config/Needs/check:
Expand Down
62 changes: 3 additions & 59 deletions R/partial_bundles.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ verify_partial_bundle <- function(p) {

if (identical(bundleType, "auto")) {

# resolve an auto bundle by using the 1st bundle that supports all the types
# (ordering of bundleTraceMap is important!)
for (i in seq_along(bundleTraceMap)) {
# resolve an auto bundle by using the 1st bundle that supports all the types,
# except for the 'strict' bundle (ordering of bundleTraceMap is important!)
for (i in seq_along(bundleTraceMap[names(bundleTraceMap) != "strict"])) {
if (all(types %in% bundleTraceMap[[i]])) {
bundleType <- names(bundleTraceMap)[[i]]
break
Expand Down Expand Up @@ -158,59 +158,3 @@ plotlyjsBundleIDX <- function(p) {
plotlyjsBundle <- function(p) {
p$dependencies[[plotlyjsBundleIDX(p)]]
}

# TODO: create this object in inst/plotlyjs.R from the dist/README.md
bundleTraceMap <- list(
basic = c(
"scatter",
"bar",
"pie"
),
cartesian = c(
"scatter",
"bar",
"pie",
"box",
"heatmap",
"histogram",
"histogram2d",
"histogram2dcontour",
"contour",
"scatterternary",
"violin"
),
geo = c(
"scatter",
"scattergeo",
"choropleth"
),
gl3d = c(
"scatter",
"scatter3d",
"surface",
"mesh3d",
"cone"
),
gl2d = c(
"scatter",
"scattergl",
"splom",
"pointcloud",
"heatmapgl",
"contourgl",
"parcoords"
),
mapbox = c(
"scatter",
"scattermapbox"
),
finance = c(
"scatter",
"bar",
"pie",
"histogram",
"ohlc",
"candlestick",
"waterfall"
)
)
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/testthat/test-plotly-partial-bundles.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test_that("Throws an informative error if wrong bundle is specified", {

expect_error(
partial_bundle(p1, type = "basic"),
"The 'basic' bundle supports the following trace types: 'scatter', 'bar', 'pie'"
"The 'basic' bundle supports the following trace types: 'bar', 'pie', 'scatter'"
)
})

Expand Down
24 changes: 20 additions & 4 deletions tools/update_plotlyjs.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,28 @@ withr::with_dir(tmpdir, {
file.path(lib_dir, "locales", sub("^plotly-locale-", "", basename(locales))),
overwrite = TRUE
)
# update plot schema
# update plot schema and (partial) bundles
if (!nzchar(system.file(package = "yay"))) {
stop("pkg 'yay' must be installed via: remotes::install_gitlab('rpkg.dev/yay')")
}
Schema <- jsonlite::fromJSON(Sys.glob("dist/plot-schema.json"))
bundleTraceMap <-
yay::gh_text_file(path = "tasks/util/constants.js",
owner = "plotly",
name = "plotly.js",
rev = basename(zip)) |>
stringr::str_extract(pattern = "(?<=var partialBundleTraces = )\\{[^}]+\\}") |>
yaml::read_yaml(text = _)

withr::with_dir(
pkg_dir, usethis::use_data(Schema, overwrite = TRUE, internal = TRUE)
pkg_dir, usethis::use_data(
Schema,
bundleTraceMap,
internal = TRUE,
overwrite = TRUE,
compress = "xz",
version = 3L
)
)

# plotly.js used to bundle a typedarray polyfill to support older browsers,
Expand All @@ -81,7 +99,5 @@ withr::with_dir(tmpdir, {
#)

message("Update plotlyMainBundle()'s version with ", basename(zip))

})

})