2020-03-04 11:55:23 +01:00
|
|
|
% Generated by roxygen2: do not edit by hand
|
|
|
|
% Please edit documentation in R/shiny-input.R
|
|
|
|
\name{set_input_click}
|
|
|
|
\alias{set_input_click}
|
|
|
|
\title{Retrieve click information in Shiny}
|
|
|
|
\usage{
|
2020-03-04 12:04:47 +01:00
|
|
|
set_input_click(
|
|
|
|
ax,
|
|
|
|
inputId,
|
|
|
|
multiple = FALSE,
|
|
|
|
effect_type = c("darken", "lighten", "none"),
|
2020-03-04 15:14:02 +01:00
|
|
|
effect_value = 0.35,
|
|
|
|
session = shiny::getDefaultReactiveDomain()
|
2020-03-04 12:04:47 +01:00
|
|
|
)
|
2020-03-04 11:55:23 +01:00
|
|
|
}
|
|
|
|
\arguments{
|
|
|
|
\item{ax}{An \code{apexcharts} \code{htmlwidget} object.}
|
|
|
|
|
2020-03-04 19:02:01 +01:00
|
|
|
\item{inputId}{The id that will be used server-side for retrieving click.}
|
2020-03-04 11:55:23 +01:00
|
|
|
|
|
|
|
\item{multiple}{Allow multiple selection: \code{TRUE} or \code{FALSE} (default).}
|
2020-03-04 12:04:47 +01:00
|
|
|
|
|
|
|
\item{effect_type}{Type of effect for selected element, default is to use lightly darken color.}
|
|
|
|
|
|
|
|
\item{effect_value}{A larger value intensifies the select effect, accept value between 0 and 1.}
|
2020-03-04 15:14:02 +01:00
|
|
|
|
|
|
|
\item{session}{The Shiny session.}
|
2020-03-04 11:55:23 +01:00
|
|
|
}
|
|
|
|
\value{
|
|
|
|
An \code{apexcharts} \code{htmlwidget} object.
|
|
|
|
}
|
|
|
|
\description{
|
|
|
|
According to type of chart, different values are retrieved:
|
|
|
|
\itemize{
|
|
|
|
\item \strong{bar and column:} retrieve category (x-axis).
|
|
|
|
\item \strong{pie and donut:} retrieve label.
|
|
|
|
\item \strong{time-series:} retrieve x-axis value, you have to display markers
|
|
|
|
with size > 0 and set tooltip's options \code{intersect = TRUE} and \code{shared = FALSE}.
|
2020-03-17 12:22:31 +01:00
|
|
|
\item \strong{scatter:} retrieve XY coordinates.
|
|
|
|
}
|
|
|
|
}
|
2020-03-18 12:30:48 +01:00
|
|
|
\note{
|
|
|
|
If x-axis is of type datetime, value retrieved is of class \code{POSIXct}.
|
|
|
|
}
|
2020-03-17 12:22:31 +01:00
|
|
|
\examples{
|
2020-03-18 12:30:48 +01:00
|
|
|
|
|
|
|
library(apexcharter)
|
|
|
|
|
|
|
|
# Not in Shiny but you can still click on bars
|
|
|
|
data.frame(
|
|
|
|
month = month.abb,
|
|
|
|
value = sample(1:100, 12)
|
|
|
|
) \%>\%
|
|
|
|
apex(aes(month, value)) \%>\%
|
|
|
|
set_input_click("month_click", multiple = TRUE)
|
|
|
|
|
|
|
|
|
|
|
|
# Interactive examples:
|
2020-03-17 12:22:31 +01:00
|
|
|
if (interactive()) {
|
|
|
|
|
2020-11-02 11:30:44 +01:00
|
|
|
run_demo_input("click")
|
2020-03-17 12:22:31 +01:00
|
|
|
|
2020-03-04 11:55:23 +01:00
|
|
|
}
|
|
|
|
}
|