rename fun
This commit is contained in:
parent
e7adeb7bee
commit
481930aabe
|
@ -3,9 +3,9 @@
|
||||||
export("%>%")
|
export("%>%")
|
||||||
export(aes)
|
export(aes)
|
||||||
export(apex)
|
export(apex)
|
||||||
|
export(apexchart)
|
||||||
export(apexchartOutput)
|
export(apexchartOutput)
|
||||||
export(apexchartProxy)
|
export(apexchartProxy)
|
||||||
export(apexcharter)
|
|
||||||
export(ax_annotations)
|
export(ax_annotations)
|
||||||
export(ax_chart)
|
export(ax_chart)
|
||||||
export(ax_colors)
|
export(ax_colors)
|
||||||
|
|
|
@ -384,14 +384,14 @@ ax_responsive <- function(ax, ...) {
|
||||||
#' @examples
|
#' @examples
|
||||||
#'
|
#'
|
||||||
#' # One serie
|
#' # One serie
|
||||||
#' apexcharter() %>%
|
#' apexchart() %>%
|
||||||
#' ax_series(list(
|
#' ax_series(list(
|
||||||
#' name = "rnorm",
|
#' name = "rnorm",
|
||||||
#' data = rnorm(10)
|
#' data = rnorm(10)
|
||||||
#' ))
|
#' ))
|
||||||
#'
|
#'
|
||||||
#' # Two series
|
#' # Two series
|
||||||
#' apexcharter() %>%
|
#' apexchart() %>%
|
||||||
#' ax_series(
|
#' ax_series(
|
||||||
#' list(
|
#' list(
|
||||||
#' name = "rnorm 1",
|
#' name = "rnorm 1",
|
||||||
|
|
2
R/apex.R
2
R/apex.R
|
@ -33,7 +33,7 @@ apex <- function(data, mapping, type = "column", ..., width = NULL, height = NUL
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
opts <- modifyList(opts, choose_config(type, is_datetime(mapdata)))
|
opts <- modifyList(opts, choose_config(type, is_datetime(mapdata)))
|
||||||
apexcharter(ax_opts = opts, width = width, height = height, elementId = elementId)
|
apexchart(ax_opts = opts, width = width, height = height, elementId = elementId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
#' Create a apexcharts.js widget
|
#' Create a apexcharts.js widget
|
||||||
#'
|
#'
|
||||||
#' @param data Default dataset to use for chart. If not already a \code{data.frame}, it will be coerced to with \code{as.data.frame}.
|
#' @param ax_opts A \code{list} in JSON format with chart parameters.
|
||||||
#' @param ax_opts A \code{list} in JSON format with chart parameters.#'
|
#' @param auto_update In Shiny application, update existing chart rather than generating new one.
|
||||||
#' @param width A numeric input in pixels.
|
#' @param width A numeric input in pixels.
|
||||||
#' @param height A numeric input in pixels.
|
#' @param height A numeric input in pixels.
|
||||||
#' @param elementId Use an explicit element ID for the widget.
|
#' @param elementId Use an explicit element ID for the widget.
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
#'
|
#'
|
||||||
#' library(apexcharter)
|
#' library(apexcharter)
|
||||||
#'
|
#'
|
||||||
#' apexcharter(ax_opts = list(
|
#' apexchart(ax_opts = list(
|
||||||
#' chart = list(type = "bar"),
|
#' chart = list(type = "bar"),
|
||||||
#' series = list(list(
|
#' series = list(list(
|
||||||
#' name = "Example",
|
#' name = "Example",
|
||||||
|
@ -24,18 +24,18 @@
|
||||||
#' )),
|
#' )),
|
||||||
#' xaxis = list(categories = LETTERS[1:5])
|
#' xaxis = list(categories = LETTERS[1:5])
|
||||||
#' ))
|
#' ))
|
||||||
apexcharter <- function(data = NULL, ax_opts = list(), width = NULL, height = NULL, elementId = NULL) {
|
apexchart <- function(ax_opts = list(), auto_update = TRUE, width = NULL, height = NULL, elementId = NULL) {
|
||||||
|
|
||||||
# forward options using x
|
# forward options using x
|
||||||
x <- list(
|
x <- list(
|
||||||
ax_opts = ax_opts,
|
ax_opts = ax_opts,
|
||||||
data = as.data.frame(data)
|
auto_update = auto_update
|
||||||
)
|
)
|
||||||
|
|
||||||
# create widget
|
# create widget
|
||||||
htmlwidgets::createWidget(
|
htmlwidgets::createWidget(
|
||||||
name = 'apexcharter',
|
name = 'apexcharter',
|
||||||
x,
|
x = x,
|
||||||
width = width,
|
width = width,
|
||||||
height = height,
|
height = height,
|
||||||
package = 'apexcharter',
|
package = 'apexcharter',
|
||||||
|
|
|
@ -59,7 +59,7 @@ library(apexcharter)
|
||||||
data(mpg, package = "ggplot2")
|
data(mpg, package = "ggplot2")
|
||||||
n_manufac <- dplyr::count(mpg, manufacturer)
|
n_manufac <- dplyr::count(mpg, manufacturer)
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "bar") %>%
|
ax_chart(type = "bar") %>%
|
||||||
ax_plotOptions(bar = barOpts(
|
ax_plotOptions(bar = barOpts(
|
||||||
horizontal = FALSE,
|
horizontal = FALSE,
|
||||||
|
@ -92,7 +92,7 @@ apexcharter() %>%
|
||||||
Pass a list of parameters to the function:
|
Pass a list of parameters to the function:
|
||||||
|
|
||||||
``` r
|
``` r
|
||||||
apexcharter(ax_opts = list(
|
apexchart(ax_opts = list(
|
||||||
chart = list(
|
chart = list(
|
||||||
type = "line"
|
type = "line"
|
||||||
),
|
),
|
||||||
|
|
|
@ -13,7 +13,7 @@ library(dplyr)
|
||||||
data(mpg)
|
data(mpg)
|
||||||
dat <- count(mpg, manufacturer)
|
dat <- count(mpg, manufacturer)
|
||||||
|
|
||||||
apexcharter(ax_opts = list(
|
apexchart(ax_opts = list(
|
||||||
chart = list(type = "bar"),
|
chart = list(type = "bar"),
|
||||||
plotOptions = list(
|
plotOptions = list(
|
||||||
bar = list(
|
bar = list(
|
||||||
|
@ -43,7 +43,7 @@ apexcharter(ax_opts = list(
|
||||||
|
|
||||||
# recreating (mostly): https://apexcharts.com/javascript-chart-demos/line-charts/data-labels/
|
# recreating (mostly): https://apexcharts.com/javascript-chart-demos/line-charts/data-labels/
|
||||||
|
|
||||||
apexcharter(ax_opts = list(
|
apexchart(ax_opts = list(
|
||||||
chart = list(
|
chart = list(
|
||||||
type = "line"
|
type = "line"
|
||||||
),
|
),
|
||||||
|
|
|
@ -23,7 +23,7 @@ library(dplyr) # for count
|
||||||
data(mpg)
|
data(mpg)
|
||||||
dat <- count(mpg, manufacturer)
|
dat <- count(mpg, manufacturer)
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "bar") %>%
|
ax_chart(type = "bar") %>%
|
||||||
ax_plotOptions(bar = barOpts(
|
ax_plotOptions(bar = barOpts(
|
||||||
horizontal = FALSE,
|
horizontal = FALSE,
|
||||||
|
@ -55,7 +55,7 @@ apexcharter() %>%
|
||||||
data(mpg)
|
data(mpg)
|
||||||
dat <- count(mpg, manufacturer)
|
dat <- count(mpg, manufacturer)
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "bar") %>%
|
ax_chart(type = "bar") %>%
|
||||||
ax_plotOptions(bar = barOpts(
|
ax_plotOptions(bar = barOpts(
|
||||||
horizontal = TRUE,
|
horizontal = TRUE,
|
||||||
|
@ -86,7 +86,7 @@ apexcharter() %>%
|
||||||
|
|
||||||
stacked <- count(mpg, manufacturer, year)
|
stacked <- count(mpg, manufacturer, year)
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "bar", stacked = TRUE) %>%
|
ax_chart(type = "bar", stacked = TRUE) %>%
|
||||||
ax_series(
|
ax_series(
|
||||||
list(
|
list(
|
||||||
|
@ -113,7 +113,7 @@ apexcharter() %>%
|
||||||
|
|
||||||
stacked <- count(mpg, manufacturer, year)
|
stacked <- count(mpg, manufacturer, year)
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "bar", stacked = FALSE) %>%
|
ax_chart(type = "bar", stacked = FALSE) %>%
|
||||||
ax_plotOptions(bar = barOpts(
|
ax_plotOptions(bar = barOpts(
|
||||||
endingShape = "rounded"
|
endingShape = "rounded"
|
||||||
|
|
|
@ -28,7 +28,7 @@ mtcars_long <- mtcars %>%
|
||||||
|
|
||||||
mtcars_long$value <- round(mtcars_long$value)
|
mtcars_long$value <- round(mtcars_long$value)
|
||||||
|
|
||||||
test <- apexcharter() %>%
|
test <- apexchart() %>%
|
||||||
ax_chart(type = "heatmap") %>%
|
ax_chart(type = "heatmap") %>%
|
||||||
ax_dataLabels(enabled = FALSE) %>%
|
ax_dataLabels(enabled = FALSE) %>%
|
||||||
ax_series2(lapply(
|
ax_series2(lapply(
|
||||||
|
@ -46,7 +46,7 @@ test <- apexcharter() %>%
|
||||||
ax_xaxis(type = "category", categories = unique(mtcars_long$variable))
|
ax_xaxis(type = "category", categories = unique(mtcars_long$variable))
|
||||||
|
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "heatmap") %>%
|
ax_chart(type = "heatmap") %>%
|
||||||
ax_dataLabels(enabled = FALSE) %>%
|
ax_dataLabels(enabled = FALSE) %>%
|
||||||
ax_series2(l = list(
|
ax_series2(l = list(
|
||||||
|
@ -74,7 +74,7 @@ apexcharter() %>%
|
||||||
|
|
||||||
data("vaccines", package = "highcharter")
|
data("vaccines", package = "highcharter")
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "heatmap", animations = list(enabled = FALSE)) %>%
|
ax_chart(type = "heatmap", animations = list(enabled = FALSE)) %>%
|
||||||
ax_dataLabels(enabled = FALSE) %>%
|
ax_dataLabels(enabled = FALSE) %>%
|
||||||
ax_series2(lapply(
|
ax_series2(lapply(
|
||||||
|
|
|
@ -20,7 +20,7 @@ library(apexcharter)
|
||||||
|
|
||||||
# Simple pie --------------------------------------------------------------
|
# Simple pie --------------------------------------------------------------
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "pie") %>%
|
ax_chart(type = "pie") %>%
|
||||||
ax_series(23, 45, 56) %>%
|
ax_series(23, 45, 56) %>%
|
||||||
ax_labels("A", "B", "C")
|
ax_labels("A", "B", "C")
|
||||||
|
@ -31,7 +31,7 @@ apexcharter() %>%
|
||||||
# Donut -------------------------------------------------------------------
|
# Donut -------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "donut") %>%
|
ax_chart(type = "donut") %>%
|
||||||
ax_series2(c(23, 45, 56)) %>%
|
ax_series2(c(23, 45, 56)) %>%
|
||||||
ax_labels2(c("A", "B", "C"))
|
ax_labels2(c("A", "B", "C"))
|
||||||
|
|
|
@ -23,7 +23,7 @@ ui <- fluidPage(
|
||||||
server <- function(input, output, session) {
|
server <- function(input, output, session) {
|
||||||
|
|
||||||
output$graph <- renderApexchart({
|
output$graph <- renderApexchart({
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "line") %>%
|
ax_chart(type = "line") %>%
|
||||||
ax_plotOptions(line = list(curve = "smooth")) %>%
|
ax_plotOptions(line = list(curve = "smooth")) %>%
|
||||||
ax_dataLabels(enabled = FALSE) %>%
|
ax_dataLabels(enabled = FALSE) %>%
|
||||||
|
|
|
@ -20,7 +20,7 @@ library(apexcharter)
|
||||||
|
|
||||||
# Basic -------------------------------------------------------------------
|
# Basic -------------------------------------------------------------------
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "radialBar") %>%
|
ax_chart(type = "radialBar") %>%
|
||||||
ax_plotOptions(
|
ax_plotOptions(
|
||||||
radialBar = radialBarOpts(
|
radialBar = radialBarOpts(
|
||||||
|
@ -35,7 +35,7 @@ apexcharter() %>%
|
||||||
|
|
||||||
# Stroked gauge -----------------------------------------------------------
|
# Stroked gauge -----------------------------------------------------------
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "radialBar") %>%
|
ax_chart(type = "radialBar") %>%
|
||||||
ax_plotOptions(
|
ax_plotOptions(
|
||||||
radialBar = radialBarOpts(
|
radialBar = radialBarOpts(
|
||||||
|
@ -64,7 +64,7 @@ apexcharter() %>%
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "radialBar") %>%
|
ax_chart(type = "radialBar") %>%
|
||||||
# ax_plotOptions(
|
# ax_plotOptions(
|
||||||
# radialBar = radialBarOpts(
|
# radialBar = radialBarOpts(
|
||||||
|
|
|
@ -25,7 +25,7 @@ data("economics", package = "ggplot2")
|
||||||
# One serie (class Date) --------------------------------------------------
|
# One serie (class Date) --------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "area", zoom = list(enabled = TRUE)) %>%
|
ax_chart(type = "area", zoom = list(enabled = TRUE)) %>%
|
||||||
# ax_stroke(curve = "smooth") %>%
|
# ax_stroke(curve = "smooth") %>%
|
||||||
ax_plotOptions(line = list(curve = "smooth")) %>%
|
ax_plotOptions(line = list(curve = "smooth")) %>%
|
||||||
|
@ -62,7 +62,7 @@ apexcharter() %>%
|
||||||
|
|
||||||
# Two series (Date) -------------------------------------------------------
|
# Two series (Date) -------------------------------------------------------
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "line", zoom = list(enabled = TRUE)) %>%
|
ax_chart(type = "line", zoom = list(enabled = TRUE)) %>%
|
||||||
ax_plotOptions(line = list(curve = "smooth")) %>%
|
ax_plotOptions(line = list(curve = "smooth")) %>%
|
||||||
ax_dataLabels(enabled = FALSE) %>%
|
ax_dataLabels(enabled = FALSE) %>%
|
||||||
|
@ -99,7 +99,7 @@ apexcharter() %>%
|
||||||
|
|
||||||
# doesn't work since 2.0.0
|
# doesn't work since 2.0.0
|
||||||
|
|
||||||
apexcharter() %>%
|
apexchart() %>%
|
||||||
ax_chart(type = "area", scroller = list(enabled = TRUE)) %>%
|
ax_chart(type = "area", scroller = list(enabled = TRUE)) %>%
|
||||||
ax_dataLabels(enabled = FALSE) %>%
|
ax_dataLabels(enabled = FALSE) %>%
|
||||||
ax_series(list(
|
ax_series(list(
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
% Generated by roxygen2: do not edit by hand
|
% Generated by roxygen2: do not edit by hand
|
||||||
% Please edit documentation in R/apexcharter.R
|
% Please edit documentation in R/apexcharter.R
|
||||||
\name{apexcharter}
|
\name{apexchart}
|
||||||
\alias{apexcharter}
|
\alias{apexchart}
|
||||||
\title{Create a apexcharts.js widget}
|
\title{Create a apexcharts.js widget}
|
||||||
\usage{
|
\usage{
|
||||||
apexcharter(data = NULL, ax_opts = list(), width = NULL,
|
apexchart(ax_opts = list(), auto_update = TRUE, width = NULL,
|
||||||
height = NULL, elementId = NULL)
|
height = NULL, elementId = NULL)
|
||||||
}
|
}
|
||||||
\arguments{
|
\arguments{
|
||||||
\item{data}{Default dataset to use for chart. If not already a \code{data.frame}, it will be coerced to with \code{as.data.frame}.}
|
\item{ax_opts}{A \code{list} in JSON format with chart parameters.}
|
||||||
|
|
||||||
\item{ax_opts}{A \code{list} in JSON format with chart parameters.#'}
|
\item{auto_update}{In Shiny application, update existing chart rather than generating new one.}
|
||||||
|
|
||||||
\item{width}{A numeric input in pixels.}
|
\item{width}{A numeric input in pixels.}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ Create a apexcharts.js widget
|
||||||
|
|
||||||
library(apexcharter)
|
library(apexcharter)
|
||||||
|
|
||||||
apexcharter(ax_opts = list(
|
apexchart(ax_opts = list(
|
||||||
chart = list(type = "bar"),
|
chart = list(type = "bar"),
|
||||||
series = list(list(
|
series = list(list(
|
||||||
name = "Example",
|
name = "Example",
|
|
@ -26,14 +26,14 @@ Add data to a chart
|
||||||
\examples{
|
\examples{
|
||||||
|
|
||||||
# One serie
|
# One serie
|
||||||
apexcharter() \%>\%
|
apexchart() \%>\%
|
||||||
ax_series(list(
|
ax_series(list(
|
||||||
name = "rnorm",
|
name = "rnorm",
|
||||||
data = rnorm(10)
|
data = rnorm(10)
|
||||||
))
|
))
|
||||||
|
|
||||||
# Two series
|
# Two series
|
||||||
apexcharter() \%>\%
|
apexchart() \%>\%
|
||||||
ax_series(
|
ax_series(
|
||||||
list(
|
list(
|
||||||
name = "rnorm 1",
|
name = "rnorm 1",
|
||||||
|
|
Loading…
Reference in New Issue