added bubble options

This commit is contained in:
pvictor 2020-04-17 16:46:34 +02:00
parent 311dc0f18d
commit c8ff4986b5
6 changed files with 86 additions and 1 deletions

View File

@ -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)

View File

@ -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,
...
)
)
}

View File

@ -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))

View File

@ -240,7 +240,8 @@ config_bar <- function(horizontal = FALSE, datetime = FALSE) {
)
),
tooltip = list(
shared = TRUE
shared = TRUE,
followCursor = TRUE
)
)
if (isTRUE(horizontal)) {

View File

@ -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{

39
man/bubble_opts.Rd Normal file
View File

@ -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
)
)
}