updated documentation (point and marker crosslink)

This commit is contained in:
pvictor 2021-07-23 10:19:43 +02:00
parent dfd9bb07af
commit cefba791f7
No known key found for this signature in database
GPG Key ID: 31124C9F3F9268B8
8 changed files with 28 additions and 31 deletions

View File

@ -96,7 +96,8 @@ add_annotation <- function(ax, type_annotation = c("xaxis", "yaxis", "points"),
#' @param cssClass A custom Css Class to give to the annotation label elements.
#' @param padding Padding for the label: top, right, bottom, left.
#'
#' @return A \code{list} that can be used in \code{\link{add_shade}}.
#' @return A \code{list} that can be used in \code{\link{add_shade}}, \code{\link{add_point}},
#' \code{\link{add_event}}, \code{\link{add_event_marker}}.
#' @export
#'
label <- function(text = NULL,
@ -271,6 +272,8 @@ add_shade_weekend <- function(ax, color = "#848484", opacity = 0.2, label = NULL
#'
#' @return An \code{apexcharts} \code{htmlwidget} object.
#' @export
#'
#' @seealso \code{\link{add_event_marker}} to add a point.
#'
#' @example examples/add_event.R
add_event <- function(ax, when, color = "#E41A1C", dash = 4, label = NULL, ...) {
@ -287,13 +290,17 @@ add_event <- function(ax, when, color = "#E41A1C", dash = 4, label = NULL, ...)
}
#' Add an event marker to a chart
#' @title Add an event marker to a chart
#'
#' @description Add a point with a label based on a datetime.
#'
#' @param when Vector of position to place the event.
#' @inheritParams add_point
#'
#' @return An \code{apexcharts} \code{htmlwidget} object.
#' @export
#'
#' @seealso \code{\link{add_event}} to add a vertical line.
#'
#' @example examples/add_event_marker.R
add_event_marker <- function(ax, when, y,
@ -397,6 +404,8 @@ add_vline <- function(ax, value, color = "#000", dash = 0, label = NULL, ...) {
#'
#' @return An \code{apexcharts} \code{htmlwidget} object.
#' @export
#'
#' @seealso \code{\link{add_event_marker}} to add a point when x-axis is a datetime.
#'
#' @example examples/add_point.R
add_point <- function(ax, x, y,
@ -411,7 +420,7 @@ add_point <- function(ax, x, y,
ax = ax,
type_annotation = "points",
position = "front",
as_date = FALSE,
as_date = inherits(x, c("Date", "POSIXct")),
x = x, y = y,
marker = marker(
size = size,

View File

@ -39,14 +39,3 @@ apex(
x = clusters$centers[, 1],
y = clusters$centers[, 2]
)

View File

@ -53,3 +53,6 @@ apex(consumption, aes(date, value, group = type), "spline") \%>\%
add_shade(from = "2020-01-06", to = "2020-01-20")\%>\%
add_event(when = c("2020-01-11", "2020-01-29"))
}
\seealso{
\code{\link{add_event_marker}} to add a point.
}

View File

@ -47,7 +47,7 @@ or see \code{\link{label}} for more controls.}
An \code{apexcharts} \code{htmlwidget} object.
}
\description{
Add an event marker to a chart
Add a point with a label based on a datetime.
}
\examples{
library(apexcharter)
@ -74,3 +74,6 @@ apex(consumption, aes(date, value, group = type), "spline") \%>\%
color = "firebrick"
)
}
\seealso{
\code{\link{add_event}} to add a vertical line.
}

View File

@ -91,15 +91,7 @@ apex(
x = clusters$centers[, 1],
y = clusters$centers[, 2]
)
}
\seealso{
\code{\link{add_event_marker}} to add a point when x-axis is a datetime.
}

View File

@ -51,7 +51,8 @@ label(
\item{padding}{Padding for the label: top, right, bottom, left.}
}
\value{
A \code{list} that can be used in \code{\link{add_shade}}.
A \code{list} that can be used in \code{\link{add_shade}}, \code{\link{add_point}},
\code{\link{add_event}}, \code{\link{add_event_marker}}.
}
\description{
Label for annotations

View File

@ -41,7 +41,7 @@ apex(data = diamonds, type = "column", mapping = aes(x = cut)) %>%
)
```
If you more control (font size, alignment, ...), you can use `ax_title()`, `ax_subtitle()`, `ax_xaxis()` and `ax_yaxis()`, as described below.
If you want more control (font size, alignment, ...), you can use `ax_title()`, `ax_subtitle()`, `ax_xaxis()` and `ax_yaxis()`, as described below.

View File

@ -131,7 +131,7 @@ data.frame(
More examples are available with:
```{r}
run_input_demo("click")
run_demo_input("click")
```
@ -168,7 +168,7 @@ Here values for `y` are `NULL` because zoom is only possible on x-axis, but for
More examples are available with:
```{r}
run_input_demo("zoom")
run_demo_input("zoom")
```
@ -231,5 +231,5 @@ list(
More examples are available with:
```{r}
run_input_demo("selection")
run_demo_input("selection")
```