Skip to content

add geo assets so maps render without internet connection #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: plotly
Title: Create Interactive Web Graphics via Plotly's JavaScript Graphing Library
Version: 2.0.15
Version: 2.0.16
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
email = "[email protected]"),
person("Chris", "Parmer", role = c("aut", "cph"),
Expand Down
11 changes: 10 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

Geo assests are now bundled with the package meaning that maps will now work entirely locally (without an internet connection)

Default scale value in plotly_IMAGE() should be 1.

2.0.16 -- 18 Dec 2015

Require ggplot2 2.0.0 or higher. For details, see #269.

2.0.15 -- 13 Dec 2015

Fix #346
Expand Down Expand Up @@ -48,7 +57,7 @@ Fix #313.

2.0.3 -- 18 Nov 2015

Fixed bug causing knitr options to be ignored. Also added VignetteBuilder to DESCRIPTION to vignette is available.
Fixed bug causing knitr options to be ignored. Also added VignetteBuilder to DESCRIPTION so vignette is available.

2.0.2 -- 17 Nov 2015

Expand Down
2 changes: 1 addition & 1 deletion R/plotly_IMAGE.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#'

plotly_IMAGE <- function(x, width = 1000, height = 500, format = "png",
scale = 4, out_file, ...) {
scale = 1, out_file, ...) {
x <- plotly_build(x)

bod <- list(
Expand Down
178 changes: 178 additions & 0 deletions inst/htmlwidgets/lib/plotlyjs/plotly-geo-assets.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions inst/htmlwidgets/plotly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ dependencies:
version: 1.2.1
src: "htmlwidgets/lib/plotlyjs"
script: plotly-latest.min.js
- name: plotlyjs-geo
version: 1.2.1
src: "htmlwidgets/lib/plotlyjs"
script: plotly-geo-assets.js
9 changes: 0 additions & 9 deletions inst/plotlyjs.R

This file was deleted.

13 changes: 13 additions & 0 deletions inst/update-plotlyjs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
library(httr)
x <- GET('https://api.github.com/repos/plotly/plotly.js/releases/latest')
zip <- content(x)$zipball_url
tmp <- tempfile(fileext = ".zip")
download.file(zip, tmp)
unzip(tmp)
p <- Sys.glob("plotly-plotly.js*/dist/plotly.min.js")
file.copy(p, "inst/htmlwidgets/lib/plotlyjs/plotly-latest.min.js", overwrite = T)
g <- Sys.glob("plotly-plotly.js*/dist/plotly-geo-assets.js")
file.copy(g, "inst/htmlwidgets/lib/plotlyjs/plotly-geo-assets.js", overwrite = T)
unlink("plotly-plotly.js*", recursive = T)
# update plotly.yml with version
basename(zip)