Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

When will plotly js will be updated on this package? #2348

cristiansoto-f started this conversation in General
Discussion options

This package runs on plotly.js 2.11.1 where the latest plotly.js is on version 2.31.1.

I want to make use of griddash options but I'm unable.

There are no properly guides on how to update the dependency,

I've used

library(httr)
library(rprojroot)
setwd("/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/plotly")
# get zip URL to latest plotly.js release
x <- RETRY(
 verb = "GET",
 url = 'https://api.github.com/repos/plotly/plotly.js/releases/latest',
 times = 5,
 terminate_on = c(400, 401, 403, 404),
 terminate_on_success = TRUE
)
zip <- content(x)$zipball_url
# remember where to copy over assets
pkg_dir <- find_package_root_file()
lib_dir <- find_package_root_file("htmlwidgets/lib/plotlyjs")
patches <- list.files(
 find_package_root_file("tools/patches"), 
 full.names = TRUE
)
# download, patch, and build plotly.js in temp dir
tmpdir <- tempfile()
dir.create(tmpdir)
withr::with_dir(tmpdir, {
 # download source
 download.file(zip, "plotly-js.zip")
 unzip("plotly-js.zip", exdir = "plotly-js")
 
 withr::with_dir(
 dir("plotly-js", full.names = TRUE), {
 
 # apply patches
 for (patch in patches) {
 tryCatch({
 message(sprintf("Applying %s", basename(patch)))
 system(sprintf("git apply %s", patch))
 },
 error = function(e) quit(save = "no", status = 1)
 )
 }
 
 # build just the main bundle
 # (also builds schema and locales)
 system("npm update")
 system("npm install")
 system("npm run bundle")
 
 # copy assets to R package source
 file.copy(
 "dist/plotly.min.js", 
 file.path(lib_dir, "plotly-latest.min.js"), 
 overwrite = TRUE
 )
 file.copy(
 "LICENSE", 
 file.path(lib_dir, "LICENSE"), 
 overwrite = TRUE
 )
 
 locales <- Sys.glob("dist/plotly-locale-*.js")
 file.copy(
 locales,
 file.path(lib_dir, "locales", sub("^plotly-locale-", "", basename(locales))),
 overwrite = TRUE
 )
 # update plot schema
 Schema <- jsonlite::fromJSON(Sys.glob("dist/plot-schema.json"))
 withr::with_dir(
 pkg_dir, usethis::use_data(Schema, overwrite = TRUE, internal = TRUE)
 )
 
 # plotly.js used to bundle a typedarray polyfill to support older browsers,
 # but v2 drops support for them, so it no longer includes this polyfill
 # Hopefully, we can continue to get away with using the pre-v2 polyfill
 # to support shinytest/phantomjs
 #download.file(
 # "dist/extras/typedarray.min.js",
 # "inst/htmlwidgets/lib/typedarray/typedarray.min.js"
 #)
 
 message("Update plotlyMainBundle()'s version with ", basename(zip))
 
 })
 
})

But I ran in so many errors.

So I don't know how to use latest plotly js version.

You must be logged in to vote

Replies: 1 comment

Comment options

I am working with the author, Carson Sievert, helping with maintaining this repository going forward. Update to latest plotly.js is in the making, but it would be at least several months, as I am learning a lot about the project and it is quite a daunting task to correctly update everything to latest version.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /