apexcharter/man/ax_annotations.Rd

136 lines
2.7 KiB
Plaintext
Raw Normal View History

2018-07-31 22:56:51 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/apex-utils.R
\name{ax_annotations}
\alias{ax_annotations}
\title{Annotations properties}
\usage{
2019-11-26 10:17:42 +01:00
ax_annotations(
ax,
position = NULL,
yaxis = NULL,
xaxis = NULL,
points = NULL,
...
)
2018-07-31 22:56:51 +02:00
}
\arguments{
\item{ax}{An \code{\link[=apexchart]{apexchart()}} \code{htmlwidget} object.}
2018-07-31 22:56:51 +02:00
2018-08-01 23:02:29 +02:00
\item{position}{Whether to put the annotations behind the charts or in front of it. Available Options: \code{"front"} or \code{"back"}.}
2018-07-31 22:56:51 +02:00
2018-08-01 23:02:29 +02:00
\item{yaxis}{List of lists.}
2018-07-31 22:56:51 +02:00
2018-08-01 23:02:29 +02:00
\item{xaxis}{List of lists.}
2018-07-31 22:56:51 +02:00
2018-08-01 23:02:29 +02:00
\item{points}{List of lists.}
2018-07-31 22:56:51 +02:00
\item{...}{Additional parameters.}
}
\value{
An \code{\link[=apexchart]{apexchart()}} \code{htmlwidget} object.
2018-07-31 22:56:51 +02:00
}
\description{
Annotations properties
}
2018-08-01 23:02:29 +02:00
\note{
See \url{https://apexcharts.com/docs/options/annotations/}.
}
2019-06-24 15:18:38 +02:00
\examples{
data("economics", package = "ggplot2")
# Horizontal line
apex(
data = tail(economics, 200),
mapping = aes(x = date, y = uempmed),
type = "line"
) \%>\%
ax_annotations(
yaxis = list(list(
y = 11.897,
borderColor = "firebrick",
opacity = 1,
label = list(
text = "Mean uempmed",
position = "left",
textAnchor = "start"
)
))
)
# Vertical line
apex(
data = tail(economics, 200),
mapping = aes(x = date, y = uempmed),
type = "line"
) \%>\%
ax_annotations(
xaxis = list(list(
x = htmlwidgets::JS("new Date('1 Mar 2007').getTime()"),
strokeDashArray = 0,
borderColor = "#775DD0",
label = list(
text = "A label",
borderColor = "#775DD0",
style = list(
color = "#fff",
background = "#775DD0"
)
)
))
)
# Vertical range
apex(
data = tail(economics, 200),
mapping = aes(x = date, y = uempmed),
type = "line"
) \%>\%
ax_annotations(
xaxis = list(list(
x = htmlwidgets::JS("new Date('1 Jan 2009').getTime()"),
x2 = htmlwidgets::JS("new Date('1 Feb 2010').getTime()"),
fillColor = "#B3F7CA",
opacity = 0.4,
label = list(
text = "A label",
borderColor = "#B3F7CA",
style = list(
color = "#fff",
background = "#B3F7CA"
)
)
))
)
# Point annotation
apex(
data = tail(economics, 200),
mapping = aes(x = date, y = uempmed),
type = "line"
) \%>\%
ax_annotations(
points = list(list(
x = htmlwidgets::JS("new Date('1 Jun 2010').getTime()"),
y = 25.2,
marker = list(
size = 8,
fillColor = "#fff",
strokeColor = "red",
radius = 2
),
label = list(
text = "Highest",
offsetY = 0,
borderColor = "#FF4560",
style = list(
color = "#fff",
background = "#FF4560"
)
)
))
)
}