2019-07-15 12:04:45 +02:00
|
|
|
% Generated by roxygen2: do not edit by hand
|
|
|
|
% Please edit documentation in R/apex-utils.R
|
|
|
|
\name{ax_yaxis2}
|
|
|
|
\alias{ax_yaxis2}
|
|
|
|
\title{Secondary Y-axis options}
|
|
|
|
\usage{
|
|
|
|
ax_yaxis2(ax, ...)
|
|
|
|
}
|
|
|
|
\arguments{
|
2021-11-17 11:41:10 +01:00
|
|
|
\item{ax}{An \code{\link[=apexchart]{apexchart()}} \code{htmlwidget} object.}
|
2019-07-15 12:04:45 +02:00
|
|
|
|
2019-07-19 14:11:41 +02:00
|
|
|
\item{...}{See arguments from \code{\link{ax_yaxis}}.}
|
2019-07-15 12:04:45 +02:00
|
|
|
}
|
|
|
|
\value{
|
2021-11-17 11:41:10 +01:00
|
|
|
An \code{\link[=apexchart]{apexchart()}} \code{htmlwidget} object.
|
2019-07-15 12:04:45 +02:00
|
|
|
}
|
|
|
|
\description{
|
|
|
|
Secondary Y-axis options
|
|
|
|
}
|
|
|
|
\examples{
|
2020-04-04 19:11:10 +02:00
|
|
|
library(apexcharter)
|
2019-07-15 12:04:45 +02:00
|
|
|
data("economics_long", package = "ggplot2")
|
|
|
|
|
2020-04-04 19:11:10 +02:00
|
|
|
eco <- economics_long \%>\%
|
2021-01-15 10:53:51 +01:00
|
|
|
subset(variable \%in\% c("pce", "pop")) \%>\%
|
|
|
|
transform(value = round(value))
|
2019-07-15 12:04:45 +02:00
|
|
|
|
2020-04-04 19:11:10 +02:00
|
|
|
# add second y-axis
|
|
|
|
apex(eco, aes(x = date, y = value, color = variable), type = "line") \%>\%
|
|
|
|
ax_yaxis(title = list(text = "Pce")) \%>\%
|
2019-07-15 12:04:45 +02:00
|
|
|
ax_yaxis2(opposite = TRUE, title = list(text = "Pop"))
|
2020-04-04 19:11:10 +02:00
|
|
|
|
|
|
|
# Customize axis a bit more
|
|
|
|
apex(eco, aes(x = date, y = value, color = variable), type = "line") \%>\%
|
|
|
|
ax_yaxis(
|
|
|
|
title = list(text = "Pce"),
|
|
|
|
axisBorder = list(
|
|
|
|
show = TRUE,
|
|
|
|
color = "#008FFB"
|
|
|
|
),
|
|
|
|
labels = list(
|
|
|
|
style = list(
|
|
|
|
colors = "#008FFB"
|
|
|
|
)
|
|
|
|
),
|
|
|
|
tooltip = list(
|
|
|
|
enabled = TRUE
|
|
|
|
)
|
|
|
|
) \%>\%
|
|
|
|
ax_yaxis2(
|
|
|
|
opposite = TRUE,
|
|
|
|
min = 160000,
|
|
|
|
forceNiceScale = TRUE,
|
|
|
|
title = list(text = "Pop"),
|
|
|
|
axisBorder = list(
|
|
|
|
show = TRUE,
|
|
|
|
color = "#00E396"
|
|
|
|
),
|
|
|
|
labels = list(
|
|
|
|
style = list(
|
|
|
|
colors = "#00E396"
|
|
|
|
)
|
|
|
|
),
|
|
|
|
tooltip = list(
|
|
|
|
enabled = TRUE
|
|
|
|
)
|
|
|
|
)
|
2019-07-15 12:04:45 +02:00
|
|
|
}
|