fixed timeline charts

This commit is contained in:
pvictor 2020-12-16 14:39:10 +01:00
parent 5e3be7068a
commit dea01b7e8d
2 changed files with 8 additions and 3 deletions

View File

@ -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))

View File

@ -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,