Skip to content
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

Fix rstudio windows warning #2300

Merged
merged 2 commits into from
Oct 5, 2023
Merged
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: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Closed #1947: `ggplotly()` now correctly handles `geom_vline`/`geom_hline` with empty data. Previously, if `geom_vline`/`geom_hline` was passed an empty data frame, it would result in an error. The plot is drawn even if no lines are found; this is the same behavior as `ggplot2`.

* Closed #1214: Do not warn in RStudio on Windows when scattergl is used. Recent RStudio versions can render scattergl correctly.

# 4.10.2

## New features
Expand Down
6 changes: 1 addition & 5 deletions R/plotly_build.R
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,7 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) {

# if a partial bundle was specified, make sure it supports the visualization
p <- verify_partial_bundle(p)

# scattergl currently doesn't render in RStudio on Windows
# https://github.com/ropensci/plotly/issues/1214
p <- verify_scattergl_platform(p)


# make sure plots don't get sent out of the network (for enterprise)
p$x$base_url <- get_domain()
p
Expand Down
16 changes: 0 additions & 16 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -948,22 +948,6 @@ verify_mathjax <- function(p) {
p
}

verify_scattergl_platform <- function(p) {
if (!identical(.Platform$OS.type, "windows")) return(p)
if (!is_rstudio()) return(p)

types <- vapply(p$x$data, function(x) x[["type"]] %||% "scatter", character(1))
if ("scattergl" %in% types) {
warning(
"'scattergl' trace types don't currently render in RStudio on Windows. ",
"Open in another web browser (IE, Chrome, Firefox, etc).",
call. = FALSE
)
}

p
}

has_marker <- function(types, modes) {
is_scatter <- grepl("scatter", types)
ifelse(is_scatter, grepl("marker", modes), has_attr(types, "marker"))
Expand Down