rename fun

This commit is contained in:
pvictor 2019-02-15 22:33:14 +01:00
parent e7adeb7bee
commit 481930aabe
14 changed files with 38 additions and 38 deletions

View File

@ -3,9 +3,9 @@
export("%>%")
export(aes)
export(apex)
export(apexchart)
export(apexchartOutput)
export(apexchartProxy)
export(apexcharter)
export(ax_annotations)
export(ax_chart)
export(ax_colors)

View File

@ -384,14 +384,14 @@ ax_responsive <- function(ax, ...) {
#' @examples
#'
#' # One serie
#' apexcharter() %>%
#' apexchart() %>%
#' ax_series(list(
#' name = "rnorm",
#' data = rnorm(10)
#' ))
#'
#' # Two series
#' apexcharter() %>%
#' apexchart() %>%
#' ax_series(
#' list(
#' name = "rnorm 1",

View File

@ -33,7 +33,7 @@ apex <- function(data, mapping, type = "column", ..., width = NULL, height = NUL
)
}
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)
}

View File

@ -1,8 +1,8 @@
#' 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 height A numeric input in pixels.
#' @param elementId Use an explicit element ID for the widget.
@ -16,7 +16,7 @@
#'
#' library(apexcharter)
#'
#' apexcharter(ax_opts = list(
#' apexchart(ax_opts = list(
#' chart = list(type = "bar"),
#' series = list(list(
#' name = "Example",
@ -24,18 +24,18 @@
#' )),
#' 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
x <- list(
ax_opts = ax_opts,
data = as.data.frame(data)
auto_update = auto_update
)
# create widget
htmlwidgets::createWidget(
name = 'apexcharter',
x,
x = x,
width = width,
height = height,
package = 'apexcharter',

View File

@ -59,7 +59,7 @@ library(apexcharter)
data(mpg, package = "ggplot2")
n_manufac <- dplyr::count(mpg, manufacturer)
apexcharter() %>%
apexchart() %>%
ax_chart(type = "bar") %>%
ax_plotOptions(bar = barOpts(
horizontal = FALSE,
@ -92,7 +92,7 @@ apexcharter() %>%
Pass a list of parameters to the function:
``` r
apexcharter(ax_opts = list(
apexchart(ax_opts = list(
chart = list(
type = "line"
),

View File

@ -13,7 +13,7 @@ library(dplyr)
data(mpg)
dat <- count(mpg, manufacturer)
apexcharter(ax_opts = list(
apexchart(ax_opts = list(
chart = list(type = "bar"),
plotOptions = list(
bar = list(
@ -43,7 +43,7 @@ apexcharter(ax_opts = list(
# recreating (mostly): https://apexcharts.com/javascript-chart-demos/line-charts/data-labels/
apexcharter(ax_opts = list(
apexchart(ax_opts = list(
chart = list(
type = "line"
),

View File

@ -23,7 +23,7 @@ library(dplyr) # for count
data(mpg)
dat <- count(mpg, manufacturer)
apexcharter() %>%
apexchart() %>%
ax_chart(type = "bar") %>%
ax_plotOptions(bar = barOpts(
horizontal = FALSE,
@ -55,7 +55,7 @@ apexcharter() %>%
data(mpg)
dat <- count(mpg, manufacturer)
apexcharter() %>%
apexchart() %>%
ax_chart(type = "bar") %>%
ax_plotOptions(bar = barOpts(
horizontal = TRUE,
@ -86,7 +86,7 @@ apexcharter() %>%
stacked <- count(mpg, manufacturer, year)
apexcharter() %>%
apexchart() %>%
ax_chart(type = "bar", stacked = TRUE) %>%
ax_series(
list(
@ -113,7 +113,7 @@ apexcharter() %>%
stacked <- count(mpg, manufacturer, year)
apexcharter() %>%
apexchart() %>%
ax_chart(type = "bar", stacked = FALSE) %>%
ax_plotOptions(bar = barOpts(
endingShape = "rounded"

View File

@ -28,7 +28,7 @@ mtcars_long <- mtcars %>%
mtcars_long$value <- round(mtcars_long$value)
test <- apexcharter() %>%
test <- apexchart() %>%
ax_chart(type = "heatmap") %>%
ax_dataLabels(enabled = FALSE) %>%
ax_series2(lapply(
@ -46,7 +46,7 @@ test <- apexcharter() %>%
ax_xaxis(type = "category", categories = unique(mtcars_long$variable))
apexcharter() %>%
apexchart() %>%
ax_chart(type = "heatmap") %>%
ax_dataLabels(enabled = FALSE) %>%
ax_series2(l = list(
@ -74,7 +74,7 @@ apexcharter() %>%
data("vaccines", package = "highcharter")
apexcharter() %>%
apexchart() %>%
ax_chart(type = "heatmap", animations = list(enabled = FALSE)) %>%
ax_dataLabels(enabled = FALSE) %>%
ax_series2(lapply(

View File

@ -20,7 +20,7 @@ library(apexcharter)
# Simple pie --------------------------------------------------------------
apexcharter() %>%
apexchart() %>%
ax_chart(type = "pie") %>%
ax_series(23, 45, 56) %>%
ax_labels("A", "B", "C")
@ -31,7 +31,7 @@ apexcharter() %>%
# Donut -------------------------------------------------------------------
apexcharter() %>%
apexchart() %>%
ax_chart(type = "donut") %>%
ax_series2(c(23, 45, 56)) %>%
ax_labels2(c("A", "B", "C"))

View File

@ -23,7 +23,7 @@ ui <- fluidPage(
server <- function(input, output, session) {
output$graph <- renderApexchart({
apexcharter() %>%
apexchart() %>%
ax_chart(type = "line") %>%
ax_plotOptions(line = list(curve = "smooth")) %>%
ax_dataLabels(enabled = FALSE) %>%

View File

@ -20,7 +20,7 @@ library(apexcharter)
# Basic -------------------------------------------------------------------
apexcharter() %>%
apexchart() %>%
ax_chart(type = "radialBar") %>%
ax_plotOptions(
radialBar = radialBarOpts(
@ -35,7 +35,7 @@ apexcharter() %>%
# Stroked gauge -----------------------------------------------------------
apexcharter() %>%
apexchart() %>%
ax_chart(type = "radialBar") %>%
ax_plotOptions(
radialBar = radialBarOpts(
@ -64,7 +64,7 @@ apexcharter() %>%
apexcharter() %>%
apexchart() %>%
ax_chart(type = "radialBar") %>%
# ax_plotOptions(
# radialBar = radialBarOpts(

View File

@ -25,7 +25,7 @@ data("economics", package = "ggplot2")
# One serie (class Date) --------------------------------------------------
apexcharter() %>%
apexchart() %>%
ax_chart(type = "area", zoom = list(enabled = TRUE)) %>%
# ax_stroke(curve = "smooth") %>%
ax_plotOptions(line = list(curve = "smooth")) %>%
@ -62,7 +62,7 @@ apexcharter() %>%
# Two series (Date) -------------------------------------------------------
apexcharter() %>%
apexchart() %>%
ax_chart(type = "line", zoom = list(enabled = TRUE)) %>%
ax_plotOptions(line = list(curve = "smooth")) %>%
ax_dataLabels(enabled = FALSE) %>%
@ -99,7 +99,7 @@ apexcharter() %>%
# doesn't work since 2.0.0
apexcharter() %>%
apexchart() %>%
ax_chart(type = "area", scroller = list(enabled = TRUE)) %>%
ax_dataLabels(enabled = FALSE) %>%
ax_series(list(

View File

@ -1,16 +1,16 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/apexcharter.R
\name{apexcharter}
\alias{apexcharter}
\name{apexchart}
\alias{apexchart}
\title{Create a apexcharts.js widget}
\usage{
apexcharter(data = NULL, ax_opts = list(), width = NULL,
apexchart(ax_opts = list(), auto_update = TRUE, width = NULL,
height = NULL, elementId = NULL)
}
\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.}
@ -28,7 +28,7 @@ Create a apexcharts.js widget
library(apexcharter)
apexcharter(ax_opts = list(
apexchart(ax_opts = list(
chart = list(type = "bar"),
series = list(list(
name = "Example",

View File

@ -26,14 +26,14 @@ Add data to a chart
\examples{
# One serie
apexcharter() \%>\%
apexchart() \%>\%
ax_series(list(
name = "rnorm",
data = rnorm(10)
))
# Two series
apexcharter() \%>\%
apexchart() \%>\%
ax_series(
list(
name = "rnorm 1",