diff --git a/R/apex.R b/R/apex.R index 3310a3b..7594a2a 100644 --- a/R/apex.R +++ b/R/apex.R @@ -121,7 +121,7 @@ make_series <- function(mapdata, mapping, type = NULL, serie_name = NULL, force_ warning("'group' aesthetic in candlestick chart is not supported", call. = FALSE) mapdata$group <- NULL series <- parse_candlestick_data(mapdata) - } else if (identical(type, "rangeBar")) { + } else if (isTRUE(type %in% c("rangeBar", "timeline"))) { if (!all(c("x", "start", "end") %in% names(mapping))) stop("For timeline charts 'x', 'start', and 'end' aesthetics must be provided.", call. = FALSE) if (is.null(mapdata$group)) diff --git a/examples/timeline.R b/examples/timeline.R index 7ed72be..8e6fbcd 100644 --- a/examples/timeline.R +++ b/examples/timeline.R @@ -2,8 +2,13 @@ library(apexcharter) data("presidential", package = "ggplot2") -# Basic -apex(presidential, aes(x = name, start = start, end = end), "timeline") +# Basic (with formated date in tooltip) +apex(presidential, aes(x = name, start = start, end = end), "timeline") %>% + ax_tooltip( + x = list( + format = "yyyy" + ) + ) # With groups apex(presidential,