Skip to content

Commit ff5f329

Browse files
committed
ensure sunburst defaults to a white stroke
1 parent 3d9489e commit ff5f329

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

R/plotly_build.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) {
136136
trace <- verify_type(trace)
137137
# verify orientation of boxes/bars
138138
trace <- verify_orientation(trace)
139+
# supply sensible defaults based on trace type
140+
trace <- coerce_attr_defaults(trace)
141+
142+
139143

140144
# attach crosstalk info, if necessary
141145
if (crosstalk_key() %in% names(dat) && isTRUE(trace[["inherit"]] %||% TRUE)) {
@@ -1022,3 +1026,12 @@ has_fill <- function(trace) {
10221026
if (has_fillcolor && isTRUE(fill != "none")) return(TRUE)
10231027
FALSE
10241028
}
1029+
1030+
# ensure we've set a sensible trace defaults
1031+
# based on the trace type
1032+
coerce_attr_defaults <- function(trace) {
1033+
if (identical(trace[["type"]], "sunburst")) {
1034+
trace$stroke <- trace[["stroke"]] %||% I("white")
1035+
}
1036+
trace
1037+
}

0 commit comments

Comments
 (0)