Skip to content

Commit 771d584

Browse files
authored
Add crosstalk mapping to computed_mapping (not mapping) when present (#1964)
* Follow up to #1952: add crosstalk mapping to computed_mapping (not mapping) when present * use dev version; update news
1 parent 9fe33eb commit 771d584

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

Diff for: DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: plotly
22
Title: Create Interactive Web Graphics via 'plotly.js'
3-
Version: 4.9.4
3+
Version: 4.9.4.9000
44
Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"),
55
email = "[email protected]", comment = c(ORCID = "0000-0002-4958-2844")),
66
person("Chris", "Parmer", role = "aut",

Diff for: NEWS.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# 4.9.4.9000
2+
3+
## BUG FIXES
4+
5+
* Fixes a bug in `ggplotly()` with `{crosstalk}` and `{ggplot2}` v3.3.4 (#1952).
6+
17
# 4.9.4
28

39
## BUG FIXES
410

511
* Duplicate `highlight(selectize=T)` dropdowns are no longer rendered in Shiny (#1936).
612
* `group_by.plotly()` now properly retains crosstalk information across `{dplyr}` versions (#1920).
7-
* Adds fixes in `ggplotly()` for the upcoming `{ggplot2}` >3.3.3 release (#1952).
13+
* Adds fixes in `ggplotly()` for the upcoming `{ggplot2}` v3.3.4 release (#1952).
814
* Fixes some issues with `name` and `frames` when both attributes are specified. (#1903 and #1618).
915

1016
# 4.9.3

Diff for: R/ggplotly.R

+6-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,12 @@ gg2list <- function(p, width = NULL, height = NULL,
264264
layers <- Map(function(x, y) {
265265
if (crosstalk_key() %in% names(y) && !"key" %in% names(x[["mapping"]]) &&
266266
inherits(x[["stat"]], "StatIdentity")) {
267-
x[["mapping"]] <- c(x[["mapping"]], key = as.name(crosstalk_key()))
267+
# ggplot2 v3.3.4 started using the computed_mapping (instead of mapping)
268+
# field to inform the compute_aesthetics() method, so in order to add
269+
# the crosstalk key, we need to add to that field (when present)
270+
# https://github.com/tidyverse/ggplot2/pull/4475
271+
nm <- if ("computed_mapping" %in% names(x)) "computed_mapping" else "mapping"
272+
x[[nm]] <- c(x[[nm]], key = as.name(crosstalk_key()))
268273
}
269274
x
270275
}, layers, layer_data)

0 commit comments

Comments
 (0)