Retrieve selection information in Shiny
set_input_selection(
ax,
inputId,
type = c("x", "xy", "y"),
fill_color = "#24292e",
fill_opacity = 0.1,
stroke_width = 1,
stroke_dasharray = 3,
stroke_color = "#24292e",
stroke_opacity = 0.4,
xmin = NULL,
xmax = NULL,
ymin = NULL,
ymax = NULL,
session = shiny::getDefaultReactiveDomain()
)
An apexcharts
htmlwidget
object.
The id that will be used server-side for retrieving selection.
Allow selection either on x-axis, y-axis or on both axis.
Background color of the selection rect which is drawn when user drags on the chart.
Opacity of background color of the selection rectangle.
Border thickness of the selection rectangle.
Creates dashes in borders of selection rectangle. Higher number creates more space between dashes in the border.
Colors of selection border.
Opacity of selection border.
Start value of x-axis. Both min
and max
must be provided.
Start value of y-axis. Both min
and max
must be provided.
The Shiny session.
An apexcharts
htmlwidget
object.
library(apexcharter)
data("economics", package = "ggplot2")
# Not in Shiny so no events
# but you can still select an area on chart
apex(economics, aes(date, psavert), type = "line") %>%
set_input_selection("selection")
# Default selection at start
apex(economics, aes(date, psavert), type = "line") %>%
set_input_selection(
inputId = "selection",
xmin = format_date("1980-01-01"),
xmax = format_date("1985-01-01")
)