update ApexCharts to 2.4.2

This commit is contained in:
pvictor 2018-12-18 18:02:09 +01:00
parent 994ad59151
commit 7143c6d378
6 changed files with 24 additions and 6 deletions

View File

@ -1,5 +1,5 @@
Package: apexcharter
Version: 0.0.0.9400
Version: 0.0.0.9500
Title: Create Interactive Chart with the JavaScript 'ApexCharts' Library
Description: Provides an 'htmlwidgets' interface to 'apexcharts.js'.
Authors@R: c(

View File

@ -40,4 +40,5 @@ importFrom(htmlwidgets,shinyRenderWidget)
importFrom(htmlwidgets,shinyWidgetOutput)
importFrom(htmlwidgets,sizingPolicy)
importFrom(magrittr,"%>%")
importFrom(stats,setNames)
importFrom(utils,modifyList)

View File

@ -4,12 +4,16 @@
#' @description Convert data to a format suitable for ApexCharts.js
#'
#' @param data A \code{data.frame} or an object coercible to \code{data.frame}.
#' @param add_names Use names of columns in output. Can be logical to
#' reuse \code{data} names or a character vector of new names.
#'
#' @export
#' @importFrom data.table transpose
#' @importFrom stats setNames
#'
parse_df <- function(data) {
parse_df <- function(data, add_names = FALSE) {
data <- as.data.frame(data)
names_ <- names(data)
l <- lapply(
X = data[],
FUN = function(x) {
@ -24,5 +28,14 @@ parse_df <- function(data) {
}
}
)
data.table::transpose(l)
ll <- data.table::transpose(l)
if (isTRUE(add_names)) {
ll <- lapply(ll, as.list)
ll <- lapply(ll, setNames, nm = names_)
}
if (is.character(add_names) & length(add_names) == length(names_)) {
ll <- lapply(ll, as.list)
ll <- lapply(ll, setNames, nm = add_names)
}
return(ll)
}

View File

@ -1,5 +1,5 @@
dependencies:
- name: apexcharts
version: 2.2.3
src: htmlwidgets/lib/apexcharts-2.2
version: 2.4.2
src: htmlwidgets/lib/apexcharts-2.4
script: apexcharts.min.js

File diff suppressed because one or more lines are too long

View File

@ -4,10 +4,13 @@
\alias{parse_df}
\title{Convert a \code{data.frame} to a \code{list}}
\usage{
parse_df(data)
parse_df(data, add_names = FALSE)
}
\arguments{
\item{data}{A \code{data.frame} or an object coercible to \code{data.frame}.}
\item{add_names}{Use names of columns in output. Can be logical to
reuse \code{data} names or a character vector of new names.}
}
\description{
Convert data to a format suitable for ApexCharts.js