diff --git a/NAMESPACE b/NAMESPACE index 0dfeb78..439f589 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -41,6 +41,7 @@ export(ax_xaxis) export(ax_yaxis) export(ax_yaxis2) export(bar_opts) +export(bubble_opts) export(config_update) export(events_opts) export(format_date) diff --git a/R/apex-options.R b/R/apex-options.R index d313520..9ff322b 100644 --- a/R/apex-options.R +++ b/R/apex-options.R @@ -350,3 +350,42 @@ pie_opts <- function(size = NULL, ) } + + +#' @title Bubble options +#' +#' @description Use these options in \code{\link{ax_plotOptions}}. +#' +#' @param minBubbleRadius Minimum radius size of a bubble. +#' If a bubble value is too small to be displayed, this size will be used. +#' @param maxBubbleRadius Maximum radius size of a bubble. +#' If a bubble value is too large to cover the chart, this size will be used. +#' @param ... Additional parameters. +#' +#' @note See \url{https://apexcharts.com/docs/options/plotoptions/bubble/}. +#' +#' @return A \code{list} of options that can be used in \code{\link{ax_plotOptions}}. +#' @export +#' +#' @examples +#' apex( +#' data = mtcars, +#' type = "scatter", +#' mapping = aes(x = wt, y = mpg, z = qsec) +#' ) %>% +#' ax_plotOptions( +#' bubble = bubble_opts( +#' minBubbleRadius = 1, +#' maxBubbleRadius = 20 +#' ) +#' ) +bubble_opts <- function(minBubbleRadius, maxBubbleRadius, ...) { + dropNulls( + list( + minBubbleRadius = minBubbleRadius, + maxBubbleRadius = maxBubbleRadius, + ... + ) + ) +} + diff --git a/R/apex-utils.R b/R/apex-utils.R index 0ec2736..8b6a4b0 100644 --- a/R/apex-utils.R +++ b/R/apex-utils.R @@ -188,6 +188,7 @@ ax_chart <- function(ax, #' @param heatmap See \code{\link{heatmap_opts}}. #' @param radialBar See \code{\link{radialBar_opts}}. #' @param pie See \code{\link{pie_opts}}. +#' @param bubble See \code{\link{bubble_opts}}. #' @param ... Additional parameters. #' #' @return A \code{apexcharts} \code{htmlwidget} object. @@ -232,6 +233,7 @@ ax_plotOptions <- function(ax, heatmap = NULL, radialBar = NULL, pie = NULL, + bubble = NULL, ...) { params <- c(as.list(environment()), list(...))[-1] .ax_opt2(ax, "plotOptions", l = dropNulls(params)) diff --git a/R/apex.R b/R/apex.R index 37a199a..6bb5ccd 100644 --- a/R/apex.R +++ b/R/apex.R @@ -240,7 +240,8 @@ config_bar <- function(horizontal = FALSE, datetime = FALSE) { ) ), tooltip = list( - shared = TRUE + shared = TRUE, + followCursor = TRUE ) ) if (isTRUE(horizontal)) { diff --git a/man/ax_plotOptions.Rd b/man/ax_plotOptions.Rd index 683cfa3..3e3d597 100644 --- a/man/ax_plotOptions.Rd +++ b/man/ax_plotOptions.Rd @@ -10,6 +10,7 @@ ax_plotOptions( heatmap = NULL, radialBar = NULL, pie = NULL, + bubble = NULL, ... ) } @@ -24,6 +25,8 @@ ax_plotOptions( \item{pie}{See \code{\link{pie_opts}}.} +\item{bubble}{See \code{\link{bubble_opts}}.} + \item{...}{Additional parameters.} } \value{ diff --git a/man/bubble_opts.Rd b/man/bubble_opts.Rd new file mode 100644 index 0000000..aaaac3d --- /dev/null +++ b/man/bubble_opts.Rd @@ -0,0 +1,39 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/apex-options.R +\name{bubble_opts} +\alias{bubble_opts} +\title{Bubble options} +\usage{ +bubble_opts(minBubbleRadius, maxBubbleRadius, ...) +} +\arguments{ +\item{minBubbleRadius}{Minimum radius size of a bubble. +If a bubble value is too small to be displayed, this size will be used.} + +\item{maxBubbleRadius}{Maximum radius size of a bubble. +If a bubble value is too large to cover the chart, this size will be used.} + +\item{...}{Additional parameters.} +} +\value{ +A \code{list} of options that can be used in \code{\link{ax_plotOptions}}. +} +\description{ +Use these options in \code{\link{ax_plotOptions}}. +} +\note{ +See \url{https://apexcharts.com/docs/options/plotoptions/bubble/}. +} +\examples{ +apex( + data = mtcars, + type = "scatter", + mapping = aes(x = wt, y = mpg, z = qsec) +) \%>\% + ax_plotOptions( + bubble = bubble_opts( + minBubbleRadius = 1, + maxBubbleRadius = 20 + ) + ) +}