Skip to content

Commit 2518d74

Browse files
committed
Don't impose rangeslider start/end on axis range unless they are specified, fixes #1496
1 parent d9662a6 commit 2518d74

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: R/layout.R

+8-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ rangeslider <- function(p, start = NULL, end = NULL, ...) {
7373
stop("Can only add a rangeslider to a plot with one x-axis", call. = FALSE)
7474
}
7575

76-
p$x$layout$xaxis$range <- c(
77-
to_milliseconds(start),
78-
to_milliseconds(end)
79-
)
76+
if (!is.null(start) && !is.null(end)) {
77+
p$x$layout$xaxis$range <- c(
78+
to_milliseconds(start),
79+
to_milliseconds(end)
80+
)
81+
} else if (!is.null(start) || !is.null(end)) {
82+
stop("Both start and end must be specified")
83+
}
8084

8185
p$x$layout$xaxis$rangeslider <- list(visible = TRUE, ...)
8286
p

0 commit comments

Comments
 (0)