set_input_selection | R Documentation |
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()
)
ax |
An |
inputId |
The id that will be used server-side for retrieving selection. |
type |
Allow selection either on x-axis, y-axis or on both axis. |
fill_color |
Background color of the selection rect which is drawn when user drags on the chart. |
fill_opacity |
Opacity of background color of the selection rectangle. |
stroke_width |
Border thickness of the selection rectangle. |
stroke_dasharray |
Creates dashes in borders of selection rectangle. Higher number creates more space between dashes in the border. |
stroke_color |
Colors of selection border. |
stroke_opacity |
Opacity of selection border. |
xmin , xmax |
Start value of x-axis. Both |
ymin , ymax |
Start value of y-axis. Both |
session |
The Shiny session. |
An apexchart()
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")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.