diff --git a/R/annotations.R b/R/annotations.R index f8ab137..d557688 100644 --- a/R/annotations.R +++ b/R/annotations.R @@ -1,7 +1,7 @@ #' @title Add a shaded area to a chart #' -#' @description \code{add_shade()} allow to add a shadow area on specified range, +#' @description \code{add_shade()} allow to add a shaded area on specified range, #' \code{add_shade_weekend()} add a shadow on every week-end. #' #' @param ax An \code{apexcharts} \code{htmlwidget} object. diff --git a/examples/add_shade.R b/examples/add_shade.R index e3021fd..bede6cb 100644 --- a/examples/add_shade.R +++ b/examples/add_shade.R @@ -13,7 +13,20 @@ apex(consumption, aes(date, value, group = type), "spline") %>% # or use a vector apex(consumption, aes(date, value, group = type), "spline") %>% - add_shade(from = c("2020-01-06", "2020-02-04"), to = c("2020-01-20", "2020-02-10")) + add_shade( + from = c("2020-01-06", "2020-02-04"), + to = c("2020-01-20", "2020-02-10") + ) + +# add other options +apex(consumption, aes(date, value, group = type), "spline") %>% + add_shade( + from = "2020-01-06", to = "2020-01-20", + color = "firebrick", + label = list( + text = "something happened" + ) + ) # automatically add shadow on week-ends diff --git a/man/add-shade.Rd b/man/add-shade.Rd index 2a69e54..83b7e6c 100644 --- a/man/add-shade.Rd +++ b/man/add-shade.Rd @@ -28,7 +28,7 @@ add_shade_weekend(ax, color = "#848484", opacity = 0.2, ...) An \code{apexcharts} \code{htmlwidget} object. } \description{ -\code{add_shade()} allow to add a shadow area on specified range, +\code{add_shade()} allow to add a shaded area on specified range, \code{add_shade_weekend()} add a shadow on every week-end. } \note{ @@ -51,7 +51,20 @@ apex(consumption, aes(date, value, group = type), "spline") \%>\% # or use a vector apex(consumption, aes(date, value, group = type), "spline") \%>\% - add_shade(from = c("2020-01-06", "2020-02-04"), to = c("2020-01-20", "2020-02-10")) + add_shade( + from = c("2020-01-06", "2020-02-04"), + to = c("2020-01-20", "2020-02-10") + ) + +# add other options +apex(consumption, aes(date, value, group = type), "spline") \%>\% + add_shade( + from = "2020-01-06", to = "2020-01-20", + color = "firebrick", + label = list( + text = "something happened" + ) + ) # automatically add shadow on week-ends