apexcharter/man/ax_legend.Rd

102 lines
3.0 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_legend}
\alias{ax_legend}
\title{Legend properties}
\usage{
2019-11-26 10:17:42 +01:00
ax_legend(
ax,
show = NULL,
position = NULL,
showForSingleSeries = NULL,
showForNullSeries = NULL,
showForZeroSeries = NULL,
horizontalAlign = NULL,
fontSize = NULL,
textAnchor = NULL,
offsetY = NULL,
offsetX = NULL,
formatter = NULL,
labels = NULL,
markers = NULL,
itemMargin = NULL,
containerMargin = NULL,
onItemClick = NULL,
onItemHover = NULL,
floating = 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-07-31 23:24:35 +02:00
\item{show}{Logical. Whether to show or hide the legend container.}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{position}{Available position options for legend: \code{"top"}, \code{"right"}, \code{"bottom"}, \code{"left"}.}
2018-07-31 22:56:51 +02:00
2019-06-24 15:18:38 +02:00
\item{showForSingleSeries}{Show legend even if there is just 1 series.}
2020-02-15 13:07:05 +01:00
\item{showForNullSeries}{Allows you to hide a particular legend if it's series contains all null values.}
2018-09-03 23:52:53 +02:00
2020-02-15 13:07:05 +01:00
\item{showForZeroSeries}{Allows you to hide a particular legend if it's series contains all 0 values.}
2019-06-24 15:18:38 +02:00
\item{horizontalAlign}{Available options for horizontal alignment: \code{"right"}, \code{"center"}, \code{"left"}.}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{fontSize}{Sets the fontSize of legend text elements}
2018-07-31 22:56:51 +02:00
2020-02-15 13:07:05 +01:00
\item{textAnchor}{The alignment of text relative to legend's drawing position}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{offsetY}{Sets the top offset for legend container.}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{offsetX}{Sets the left offset for legend container.}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{formatter}{JS function. A custom formatter function to append additional text to the legend series names.}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{labels}{List with two items \code{"foreColor"} (Custom text color for legend labels)
and \code{"useSeriesColors"} (Logical, whether to use primary colors or not)}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{markers}{List.}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{itemMargin}{List with two items \code{"horizontal"} (Horizontal margin for individual legend item)
and \code{"vertical"} (Vertical margin for individual legend item).}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{containerMargin}{List with two items \code{"top"} (Top margin for the whole legend container)
and \code{"left"} (Left margin for the whole legend container).}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{onItemClick}{List with item \code{"toggleDataSeries"}, logical,
when clicked on legend item, it will toggle the visibility of the series in chart.}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{onItemHover}{List with item \code{"highlightDataSeries"}, logical,
when hovered on legend item, it will highlight the paths of the hovered series in chart.}
2018-07-31 22:56:51 +02:00
2018-07-31 23:24:35 +02:00
\item{floating}{Logical. The floating option will take out the legend from the chart area and make it float above the chart.}
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{
Legend properties
}
2018-09-03 23:52:53 +02:00
\note{
See \url{https://apexcharts.com/docs/options/legend/}
}
2019-06-24 15:18:38 +02:00
\examples{
data("mpg", package = "ggplot2")
# Legend position
apex(
2021-01-15 10:53:51 +01:00
data = mpg,
mapping = aes(x = manufacturer, fill = year)
2019-06-24 15:18:38 +02:00
) \%>\%
ax_legend(position = "right")
# hide legend
apex(
2021-01-15 10:53:51 +01:00
data = mpg,
mapping = aes(x = manufacturer, fill = year)
2019-06-24 15:18:38 +02:00
) \%>\%
ax_legend(show = FALSE)
}