add_shade example

This commit is contained in:
pvictor 2020-04-02 19:38:49 +02:00
parent d3126ab26b
commit f7a8df7277
3 changed files with 30 additions and 4 deletions

View File

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

View File

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

View File

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