ax_legend | R Documentation |
Legend properties
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,
...
)
ax |
An |
show |
Logical. Whether to show or hide the legend container. |
position |
Available position options for legend: |
showForSingleSeries |
Show legend even if there is just 1 series. |
showForNullSeries |
Allows you to hide a particular legend if it's series contains all null values. |
showForZeroSeries |
Allows you to hide a particular legend if it's series contains all 0 values. |
horizontalAlign |
Available options for horizontal alignment: |
fontSize |
Sets the fontSize of legend text elements |
textAnchor |
The alignment of text relative to legend's drawing position |
offsetY |
Sets the top offset for legend container. |
offsetX |
Sets the left offset for legend container. |
formatter |
JS function. A custom formatter function to append additional text to the legend series names. |
labels |
List with two items |
markers |
List. |
itemMargin |
List with two items |
containerMargin |
List with two items |
onItemClick |
List with item |
onItemHover |
List with item |
floating |
Logical. The floating option will take out the legend from the chart area and make it float above the chart. |
... |
Additional parameters. |
An apexchart()
htmlwidget
object.
See https://apexcharts.com/docs/options/legend/
data("mpg", package = "ggplot2")
# Legend position
apex(
data = mpg,
mapping = aes(x = manufacturer, fill = year)
) %>%
ax_legend(position = "right")
# hide legend
apex(
data = mpg,
mapping = aes(x = manufacturer, fill = year)
) %>%
ax_legend(show = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.