Initialize a chart with three main parameters : data, mapping and type of chart.
apex(
data,
mapping,
type = "column",
...,
auto_update = TRUE,
synchronize = NULL,
serie_name = NULL,
width = NULL,
height = NULL,
elementId = NULL
)
Default dataset to use for chart. If not already
a data.frame
, it will be coerced to with as.data.frame
.
Default list of aesthetic mappings to use for chart
Specify the chart type. Available options:
"column"
, "bar"
,
"line"
, "step"
, "spline"
,
"area"
, "area-step"
, "area-spline"
,
"pie"
, "donut"
,
"radialBar"
, "radar"
, "scatter"
,
"heatmap"
, "treemap"
,
"timeline"
.
Other arguments passed on to methods. Not currently used.
In Shiny application, update existing chart
rather than generating new one. Can be TRUE
/FALSE
or
use config_update
for more control.
Give a common id to charts to synchronize them (tooltip and zoom).
Name for the serie displayed in tooltip, only used for single serie.
A numeric input in pixels.
A numeric input in pixels.
Use an explicit element ID for the widget.
A apexcharts
htmlwidget
object.
library(ggplot2)
#> Warning: le package 'ggplot2' a été compilé avec la version R 4.1.1
library(apexcharter)
# make a barchart with a frequency table
data("mpg", package = "ggplot2")
apex(mpg, aes(manufacturer), type = "bar")
# timeseries
data("economics", package = "ggplot2")
apex(
data = economics,
mapping = aes(x = date, y = uempmed),
type = "line"
)
# you can add option to apex result :
apex(
data = economics,
mapping = aes(x = date, y = uempmed),
type = "line"
) %>%
ax_stroke(width = 1)
# with group variable
data("economics_long", package = "ggplot2")
apex(
data = economics_long,
mapping = aes(x = date, y = value01, group = variable),
type = "line"
)