Skip to content

Commit 69787c8

Browse files
committed
Merge branch 'master' into scattergl
2 parents 7cc4dfa + 38f447f commit 69787c8

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

R/plotly_build.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) {
132132
)
133133

134134
# attach crosstalk info, if necessary
135-
if (crosstalk_key() %in% names(dat) && isTRUE(trace[["inherit"]])) {
135+
if (crosstalk_key() %in% names(dat) && isTRUE(trace[["inherit"]] %||% TRUE)) {
136136
trace[["key"]] <- trace[["key"]] %||% dat[[crosstalk_key()]]
137137
trace[["set"]] <- trace[["set"]] %||% attr(dat, "set")
138138
}

tests/testthat/test-animate-highlight.R

+16-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ test_that("SharedData produces key/set in ggplotly", {
2424
expect_false(tr$`_isSimpleKey` %||% FALSE)
2525
})
2626

27-
28-
2927
test_that("crosstalk keys are inherited in a layer with inherit = FALSE", {
3028

3129
p <- txhousing %>%
@@ -48,6 +46,22 @@ test_that("crosstalk keys are inherited in a layer with inherit = FALSE", {
4846
expect_true(b$x$data[[1]][["set"]] == "Select a city")
4947
})
5048

49+
test_that("Simple scatterplot brushing with plot_ly() and subplot()", {
50+
51+
p <- mtcars %>%
52+
crosstalk::SharedData$new(group = "testing") %>%
53+
plot_ly(x = ~mpg, y = ~wt)
54+
55+
b <- subplot(p, p) %>%
56+
highlight("plotly_selected") %>%
57+
plotly_build()
58+
59+
expect_true(all(b$x$data[[1]]$key == row.names(mtcars)))
60+
expect_true(all(b$x$data[[2]]$key == row.names(mtcars)))
61+
expect_true(b$x$data[[1]]$set == "testing")
62+
expect_true(b$x$layout$dragmode == "select")
63+
})
64+
5165

5266

5367
# Ignore for now https://github.com/ggobi/ggally/issues/264

0 commit comments

Comments
 (0)