more docs
This commit is contained in:
parent
cd51e66336
commit
ba93c07fa5
|
@ -9,12 +9,14 @@
|
||||||
#' Annotations properties
|
#' Annotations properties
|
||||||
#'
|
#'
|
||||||
#' @param ax A \code{apexcharts} \code{htmlwidget} object.
|
#' @param ax A \code{apexcharts} \code{htmlwidget} object.
|
||||||
#' @param position
|
#' @param position Whether to put the annotations behind the charts or in front of it. Available Options: \code{"front"} or \code{"back"}.
|
||||||
#' @param yaxis
|
#' @param yaxis List of lists.
|
||||||
#' @param xaxis
|
#' @param xaxis List of lists.
|
||||||
#' @param points
|
#' @param points List of lists.
|
||||||
#' @param ... Additional parameters.
|
#' @param ... Additional parameters.
|
||||||
#'
|
#'
|
||||||
|
#' @note See \url{https://apexcharts.com/docs/options/annotations/}.
|
||||||
|
#'
|
||||||
#' @return A \code{apexcharts} \code{htmlwidget} object.
|
#' @return A \code{apexcharts} \code{htmlwidget} object.
|
||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
|
@ -280,18 +282,17 @@ ax_legend <- function(ax,
|
||||||
#' Markers properties
|
#' Markers properties
|
||||||
#'
|
#'
|
||||||
#' @param ax A \code{apexcharts} \code{htmlwidget} object.
|
#' @param ax A \code{apexcharts} \code{htmlwidget} object.
|
||||||
#' @param discrete
|
#' @param size Numeric. Size of the marker point.
|
||||||
#' @param size
|
#' @param colors Sets the fill color(s) of the marker point.
|
||||||
#' @param colors
|
#' @param strokeColor Stroke Color of the marker.
|
||||||
#' @param strokeColor
|
#' @param strokeWidth Stroke Size of the marker.
|
||||||
#' @param strokeWidth
|
#' @param strokeOpacity Opacity of the border around marker.
|
||||||
#' @param strokeOpacity
|
#' @param fillOpacity Opacity of the marker fill color.
|
||||||
#' @param fillOpacity
|
#' @param shape Shape of the marker. Available Options for shape: \code{"square"} or \code{"circle"}.
|
||||||
#' @param shape
|
#' @param radius Numeric. Radius of the marker (applies to square shape)
|
||||||
#' @param radius
|
#' @param offsetX Numeric. Sets the left offset of the marker.
|
||||||
#' @param offsetX
|
#' @param offsetY Numeric. Sets the top offset of the marker.
|
||||||
#' @param offsetY
|
#' @param hover List with item \code{size} (Size of the marker when it is active).
|
||||||
#' @param hover
|
|
||||||
#' @param ... Additional parameters.
|
#' @param ... Additional parameters.
|
||||||
#'
|
#'
|
||||||
#' @return A \code{apexcharts} \code{htmlwidget} object.
|
#' @return A \code{apexcharts} \code{htmlwidget} object.
|
||||||
|
@ -299,7 +300,6 @@ ax_legend <- function(ax,
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
ax_markers <- function(ax,
|
ax_markers <- function(ax,
|
||||||
discrete = NULL,
|
|
||||||
size = NULL,
|
size = NULL,
|
||||||
colors = NULL,
|
colors = NULL,
|
||||||
strokeColor = NULL,
|
strokeColor = NULL,
|
||||||
|
@ -368,6 +368,26 @@ ax_responsive <- function(ax, ...) {
|
||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @examples
|
||||||
|
#'
|
||||||
|
#' # One serie
|
||||||
|
#' apexcharter() %>%
|
||||||
|
#' ax_series(list(
|
||||||
|
#' name = "rnorm",
|
||||||
|
#' data = rnorm(10)
|
||||||
|
#' ))
|
||||||
|
#'
|
||||||
|
#' # Two series
|
||||||
|
#' apexcharter() %>%
|
||||||
|
#' ax_series(
|
||||||
|
#' list(
|
||||||
|
#' name = "rnorm 1",
|
||||||
|
#' data = rnorm(10)
|
||||||
|
#' ),
|
||||||
|
#' list(
|
||||||
|
#' name = "rnorm 2",
|
||||||
|
#' data = rnorm(10)
|
||||||
|
#' )
|
||||||
|
#' )
|
||||||
ax_series <- function(ax, ...) {
|
ax_series <- function(ax, ...) {
|
||||||
.ax_opt(ax, "series", ...)
|
.ax_opt(ax, "series", ...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,27 @@ make_fun <- function(opts, name, file = "") {
|
||||||
return(invisible(res))
|
return(invisible(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
make_opts <- function(opts, name, file = "") {
|
||||||
|
args <- names(opts[[name]])
|
||||||
|
if (is.null(args)) {
|
||||||
|
args <- "..."
|
||||||
|
body <- "list(...)"
|
||||||
|
} else {
|
||||||
|
body <- sprintf("%s = %s", args, args)
|
||||||
|
body <- paste(body, collapse = ",\n")
|
||||||
|
body <- paste0("list(", body, ", ...)")
|
||||||
|
args <- sprintf("%s = NULL", args)
|
||||||
|
args <- paste(args, collapse = ",\n")
|
||||||
|
args <- paste0(args, ", ...")
|
||||||
|
}
|
||||||
|
body <- paste0("dropNulls(", body, ")")
|
||||||
|
res <- paste0(name, "Opts", " <- function(", args, ") {", body, "}\n\n\n")
|
||||||
|
cat(res, file = file, append = TRUE)
|
||||||
|
return(invisible(res))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# chart -------------------------------------------------------------------
|
# chart -------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -57,3 +78,16 @@ lapply(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Options -----------------------------------------------------------------
|
||||||
|
|
||||||
|
# scroller
|
||||||
|
str(ApexOpts$chart$scroller)
|
||||||
|
|
||||||
|
make_opts(ApexOpts$chart, "scroller")
|
||||||
|
|
||||||
|
# plotOptions -- bar
|
||||||
|
make_opts(ApexOpts$plotOptions, "bar")
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@ HTMLWidgets.widget({
|
||||||
ax_opts = x.ax_opts;
|
ax_opts = x.ax_opts;
|
||||||
|
|
||||||
// Sizing
|
// Sizing
|
||||||
|
if (typeof ax_opts.chart === 'undefined') {
|
||||||
|
ax_opts.chart = {};
|
||||||
|
}
|
||||||
ax_opts.chart.width = width;
|
ax_opts.chart.width = width;
|
||||||
ax_opts.chart.height = height;
|
ax_opts.chart.height = height;
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@ ax_annotations(ax, position = NULL, yaxis = NULL, xaxis = NULL,
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{ax}{A \code{apexcharts} \code{htmlwidget} object.}
|
\item{ax}{A \code{apexcharts} \code{htmlwidget} object.}
|
||||||
|
|
||||||
\item{position}{}
|
\item{position}{Whether to put the annotations behind the charts or in front of it. Available Options: \code{"front"} or \code{"back"}.}
|
||||||
|
|
||||||
\item{yaxis}{}
|
\item{yaxis}{List of lists.}
|
||||||
|
|
||||||
\item{xaxis}{}
|
\item{xaxis}{List of lists.}
|
||||||
|
|
||||||
\item{points}{}
|
\item{points}{List of lists.}
|
||||||
|
|
||||||
\item{...}{Additional parameters.}
|
\item{...}{Additional parameters.}
|
||||||
}
|
}
|
||||||
|
@ -26,3 +26,6 @@ A \code{apexcharts} \code{htmlwidget} object.
|
||||||
\description{
|
\description{
|
||||||
Annotations properties
|
Annotations properties
|
||||||
}
|
}
|
||||||
|
\note{
|
||||||
|
See \url{https://apexcharts.com/docs/options/annotations/}.
|
||||||
|
}
|
||||||
|
|
|
@ -4,37 +4,35 @@
|
||||||
\alias{ax_markers}
|
\alias{ax_markers}
|
||||||
\title{Markers properties}
|
\title{Markers properties}
|
||||||
\usage{
|
\usage{
|
||||||
ax_markers(ax, discrete = NULL, size = NULL, colors = NULL,
|
ax_markers(ax, size = NULL, colors = NULL, strokeColor = NULL,
|
||||||
strokeColor = NULL, strokeWidth = NULL, strokeOpacity = NULL,
|
strokeWidth = NULL, strokeOpacity = NULL, fillOpacity = NULL,
|
||||||
fillOpacity = NULL, shape = NULL, radius = NULL, offsetX = NULL,
|
shape = NULL, radius = NULL, offsetX = NULL, offsetY = NULL,
|
||||||
offsetY = NULL, hover = NULL, ...)
|
hover = NULL, ...)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{ax}{A \code{apexcharts} \code{htmlwidget} object.}
|
\item{ax}{A \code{apexcharts} \code{htmlwidget} object.}
|
||||||
|
|
||||||
\item{discrete}{}
|
\item{size}{Numeric. Size of the marker point.}
|
||||||
|
|
||||||
\item{size}{}
|
\item{colors}{Sets the fill color(s) of the marker point.}
|
||||||
|
|
||||||
\item{colors}{}
|
\item{strokeColor}{Stroke Color of the marker.}
|
||||||
|
|
||||||
\item{strokeColor}{}
|
\item{strokeWidth}{Stroke Size of the marker.}
|
||||||
|
|
||||||
\item{strokeWidth}{}
|
\item{strokeOpacity}{Opacity of the border around marker.}
|
||||||
|
|
||||||
\item{strokeOpacity}{}
|
\item{fillOpacity}{Opacity of the marker fill color.}
|
||||||
|
|
||||||
\item{fillOpacity}{}
|
\item{shape}{Shape of the marker. Available Options for shape: \code{"square"} or \code{"circle"}.}
|
||||||
|
|
||||||
\item{shape}{}
|
\item{radius}{Numeric. Radius of the marker (applies to square shape)}
|
||||||
|
|
||||||
\item{radius}{}
|
\item{offsetX}{Numeric. Sets the left offset of the marker.}
|
||||||
|
|
||||||
\item{offsetX}{}
|
\item{offsetY}{Numeric. Sets the top offset of the marker.}
|
||||||
|
|
||||||
\item{offsetY}{}
|
\item{hover}{List with item \code{size} (Size of the marker when it is active).}
|
||||||
|
|
||||||
\item{hover}{}
|
|
||||||
|
|
||||||
\item{...}{Additional parameters.}
|
\item{...}{Additional parameters.}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue