Skip to content

Commit 06511b7

Browse files
committed
also allow arrayOk attributes to be considered for built data
1 parent df04b27 commit 06511b7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

R/plotly_build.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,12 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) {
166166
# collect non-positional scales, plotly.js data_arrays, and "special"
167167
# array attributes for "data training"
168168
Attrs <- Schema$traces[[trace[["type"]]]]$attributes
169-
isArray <- lapply(Attrs, function(x) {
170-
tryCatch(identical(x[["valType"]], "data_array"), error = function(e) FALSE)
171-
})
169+
isArray <- vapply(Attrs, function(x) {
170+
tryFALSE(identical(x[["valType"]], "data_array"))
171+
}, logical(1))
172+
arrayOk <- vapply(Attrs, function(x) tryNULL(x[["arrayOk"]]) %||% FALSE, logical(1))
172173
# "non-tidy" traces allow x/y of different lengths, so ignore those
173-
dataArrayAttrs <- if (is_tidy(trace)) names(Attrs)[as.logical(isArray)]
174+
dataArrayAttrs <- if (is_tidy(trace)) names(Attrs)[isArray | arrayOk]
174175
allAttrs <- c(
175176
dataArrayAttrs, special_attrs(trace), npscales(), "frame",
176177
# for some reason, text isn't listed as a data array in some traces

0 commit comments

Comments
 (0)