prepare to resubmit

This commit is contained in:
pvictor 2019-07-24 12:20:22 +02:00
parent 7454bf54f3
commit 2043f88562
17 changed files with 218 additions and 51 deletions

View File

@ -7,3 +7,4 @@
^_pkgdown\.yml$
^docs$
^cran-comments\.md$
^CRAN-RELEASE$

View File

@ -1,11 +1,13 @@
Package: apexcharter
Version: 0.1.0
Version: 0.1.1
Title: Create Interactive Chart with the JavaScript 'ApexCharts' Library
Description: Provides an 'htmlwidgets' interface to 'apexcharts.js'.
Description: Provides an 'htmlwidgets' interface to 'apexcharts.js'.
'Apexcharts' is a modern JavaScript charting library to build interactive charts and visualizations with simple API.
'Apexcharts' examples and documentation are available here: <https://apexcharts.com/>.
Authors@R: c(
person("Victor", "Perrier", email = "victor.perrier@dreamrs.fr", role = c("aut", "cre")),
person("Fanny", "Meyer", email = "fanny.meyer@dreamrs.fr", role = c("aut")),
person("Juned", "Chhipa", role = c("cph"), comment = "apexcharts.js library"))
person("Fanny", "Meyer", email = "fanny.meyer@dreamrs.fr", role = "aut"),
person("Juned", "Chhipa", role = "cph", comment = "apexcharts.js library"))
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true

32
LICENSE
View File

@ -1,32 +1,2 @@
R PACKAGE
=========
YEAR: 2019
COPYRIGHT HOLDER: dreamRs
ApexCharts.js
=============
The MIT License (MIT)
Copyright (c) 2018 ApexCharts
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
COPYRIGHT HOLDER: Victor Perrier

View File

@ -23,11 +23,61 @@
#' @param ... Additional parameters.
#'
#' @note All arguments should be JavaScript function defined with \code{htmlwidgets::JS}.
#'
#' @return A \code{list} of options that can be used in \code{\link{ax_chart}}.
#'
#' @note See \url{https://apexcharts.com/docs/options/chart/events/}.
#'
#' @export
#'
#'
#' @examples
#'
#' if (interactive()) {
#' library(shiny)
#'
#' ui <- fluidPage(
#' fluidRow(
#' column(
#' width = 8, offset = 2,
#' tags$h2("Apexchart in Shiny"),
#' apexchartOutput("chart"),
#' verbatimTextOutput(outputId = "res_click")
#' )
#' )
#' )
#'
#' server <- function(input, output, session) {
#'
#' output$chart <- renderApexchart({
#' apexchart() %>%
#' ax_chart(
#' type = "bar",
#' events = events_opts(
#' dataPointSelection = JS(
#' "function(event, chartContext, config) {
#' Shiny.setInputValue('click', config.selectedDataPoints)
#' }"
#' )
#' )
#' ) %>%
#' ax_series(
#' list(
#' name = "Example",
#' data = sample(1:100, 5)
#' )
#' ) %>%
#' ax_xaxis(
#' categories = LETTERS[1:5]
#' )
#' })
#'
#' output$res_click <- renderPrint({
#' input$click
#' })
#' }
#'
#' shinyApp(ui, server)
#' }
events_opts <- function(click = NULL,
beforeMount = NULL,
mounted = NULL,
@ -63,9 +113,9 @@ events_opts <- function(click = NULL,
#' Bar options
#' @title Bar options
#'
#' Use these options in \code{\link{ax_plotOptions}}.
#' @description Use these options in \code{\link{ax_plotOptions}}.
#'
#' @param horizontal Logical. This option will turn a column chart into a horizontal bar chart.
#' @param endingShape Available Options: \code{"flat"} or \code{"rounded"}.
@ -77,6 +127,8 @@ events_opts <- function(click = NULL,
#' @param ... Additional parameters.
#'
#' @note See \url{https://apexcharts.com/docs/options/plotoptions/bar/}.
#'
#' @return A \code{list} of options that can be used in \code{\link{ax_plotOptions}}.
#'
#' @export
#'
@ -117,9 +169,9 @@ bar_opts <- function(horizontal = NULL,
}
#' Heatmap options
#' @title Heatmap options
#'
#' Use these options in \code{\link{ax_plotOptions}}.
#' @description Use these options in \code{\link{ax_plotOptions}}.
#'
#' @param radius Numeric. Radius of the rectangle inside heatmap.
#' @param enableShades Logical. Enable different shades of color depending on the value
@ -128,6 +180,8 @@ bar_opts <- function(horizontal = NULL,
#' @param ... Additional parameters.
#'
#' @note See \url{https://apexcharts.com/docs/options/plotoptions/heatmap/}.
#'
#' @return A \code{list} of options that can be used in \code{\link{ax_plotOptions}}.
#'
#' @export
#'
@ -173,9 +227,9 @@ heatmap_opts <- function(radius = NULL,
}
#' Radial bar options
#' @title Radial bar options
#'
#' Use these options in \code{\link{ax_plotOptions}}.
#' @description Use these options in \code{\link{ax_plotOptions}}.
#'
#' @param size Numeric. Manual size of the radialBars instead of calculating automatically from default height / width.
#' @param inverseOrder Logical. Whether to make the first value of series innermost or outermost.
@ -189,6 +243,8 @@ heatmap_opts <- function(radius = NULL,
#' @param ... Additional parameters.
#'
#' @note See \url{https://apexcharts.com/docs/options/plotoptions/radialbar/}.
#'
#' @return A \code{list} of options that can be used in \code{\link{ax_plotOptions}}.
#'
#' @export
#'
@ -244,9 +300,9 @@ radialBar_opts <- function(size = NULL,
}
#' Pie options
#' @title Pie options
#'
#' Use these options in \code{\link{ax_plotOptions}}.
#' @description Use these options in \code{\link{ax_plotOptions}}.
#'
#' @param size Numeric. Custom size of the pie which will override the default size calculations.
#' @param donut List with two fields \code{size} (Donut / ring size in percentage relative to the total pie area.)
@ -258,6 +314,8 @@ radialBar_opts <- function(size = NULL,
#' @param ... Additional parameters.
#'
#' @note See \url{https://apexcharts.com/docs/options/plotoptions/pie/}.
#'
#' @return A \code{list} of options that can be used in \code{\link{ax_plotOptions}}.
#'
#' @export
#'

View File

@ -1,5 +1,7 @@
#' Quick Apex Chart
#' @title Quick ApexChart
#'
#' @description Initialize a chart with three main parameters : data, mapping and type of chart.
#'
#' @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 mapping Default list of aesthetic mappings to use for chart
@ -10,6 +12,8 @@
#' @param width A numeric input in pixels.
#' @param height A numeric input in pixels.
#' @param elementId Use an explicit element ID for the widget.
#'
#' @return A \code{apexcharts} \code{htmlwidget} object.
#'
#' @export
#'

View File

@ -80,9 +80,9 @@ apexchart <- function(ax_opts = list(), auto_update = TRUE, width = NULL, height
)
}
#' Shiny bindings for apexcharter
#' @title Shiny bindings for apexcharter
#'
#' Output and render functions for using apexcharter within Shiny
#' @description Output and render functions for using apexcharter within Shiny
#' applications and interactive Rmd documents.
#'
#' @param outputId output variable to read from
@ -93,6 +93,8 @@ apexchart <- function(ax_opts = list(), auto_update = TRUE, width = NULL, height
#' @param env The environment in which to evaluate \code{expr}.
#' @param quoted Is \code{expr} a quoted expression (with \code{quote()})? This
#' is useful if you want to save an expression in a variable.
#'
#' @return An Apexchart output that can be included in the application UI.
#'
#' @name apexcharter-shiny
#'

View File

@ -6,9 +6,23 @@
#' @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.
#'
#' @return A \code{list} that can be used to specify data in \code{\link{ax_series}} for example.
#'
#' @export
#' @importFrom stats setNames
#'
#' @examples
#'
#' # All iris dataset
#' parse_df(iris)
#'
#' # Keep variables names
#' parse_df(iris[, 1:2], add_names = TRUE)
#'
#' # Use custom names
#'
#' parse_df(iris[, 1:2], add_names = c("x", "y"))
#'
parse_df <- function(data, add_names = FALSE) {
data <- as.data.frame(data)

View File

@ -7,9 +7,15 @@
0 errors | 0 warnings | 1 note
* This is a new release.
* This is a re-submission.
An htmlwidget to create visualisations with the JavaScript library ApexCharts.
Re-submission to correct the problems identified in the first submission :
* License MIT : only two lines
* Changed copyright holder in license to match Author field in description
* Updated the Description fiels, more than one sentence now
* Added a link to the JavaScript library in Description field
* All functions should have a value tag in documentation.
Thank you!

View File

@ -0,0 +1,24 @@
ApexCharts.js
=============
The MIT License (MIT)
Copyright (c) 2018 ApexCharts
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -2,7 +2,7 @@
% Please edit documentation in R/apex.R
\name{apex}
\alias{apex}
\title{Quick Apex Chart}
\title{Quick ApexChart}
\usage{
apex(data, mapping, type = "column", ..., auto_update = TRUE,
width = NULL, height = NULL, elementId = NULL)
@ -25,8 +25,11 @@ apex(data, mapping, type = "column", ..., auto_update = TRUE,
\item{elementId}{Use an explicit element ID for the widget.}
}
\value{
A \code{apexcharts} \code{htmlwidget} object.
}
\description{
Quick Apex Chart
Initialize a chart with three main parameters : data, mapping and type of chart.
}
\examples{
library(dplyr)

View File

@ -24,6 +24,9 @@ string and have \code{'px'} appended.}
\item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This
is useful if you want to save an expression in a variable.}
}
\value{
An Apexchart output that can be included in the application UI.
}
\description{
Output and render functions for using apexcharter within Shiny
applications and interactive Rmd documents.

View File

@ -25,6 +25,9 @@ bar_opts(horizontal = NULL, endingShape = NULL, columnWidth = NULL,
\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}}.
}

View File

@ -37,6 +37,9 @@ events_opts(click = NULL, beforeMount = NULL, mounted = NULL,
\item{...}{Additional parameters.}
}
\value{
A \code{list} of options that can be used in \code{\link{ax_chart}}.
}
\description{
Events options
}
@ -45,3 +48,52 @@ All arguments should be JavaScript function defined with \code{htmlwidgets::JS}.
See \url{https://apexcharts.com/docs/options/chart/events/}.
}
\examples{
if (interactive()) {
library(shiny)
ui <- fluidPage(
fluidRow(
column(
width = 8, offset = 2,
tags$h2("Apexchart in Shiny"),
apexchartOutput("chart"),
verbatimTextOutput(outputId = "res_click")
)
)
)
server <- function(input, output, session) {
output$chart <- renderApexchart({
apexchart() \%>\%
ax_chart(
type = "bar",
events = events_opts(
dataPointSelection = JS(
"function(event, chartContext, config) {
Shiny.setInputValue('click', config.selectedDataPoints)
}"
)
)
) \%>\%
ax_series(
list(
name = "Example",
data = sample(1:100, 5)
)
) \%>\%
ax_xaxis(
categories = LETTERS[1:5]
)
})
output$res_click <- renderPrint({
input$click
})
}
shinyApp(ui, server)
}
}

View File

@ -18,6 +18,9 @@ heatmap_opts(radius = NULL, enableShades = NULL,
\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}}.
}

View File

@ -12,6 +12,22 @@ parse_df(data, add_names = FALSE)
\item{add_names}{Use names of columns in output. Can be logical to
reuse \code{data} names or a character vector of new names.}
}
\value{
A \code{list} that can be used to specify data in \code{\link{ax_series}} for example.
}
\description{
Convert data to a format suitable for ApexCharts.js
}
\examples{
# All iris dataset
parse_df(iris)
# Keep variables names
parse_df(iris[, 1:2], add_names = TRUE)
# Use custom names
parse_df(iris[, 1:2], add_names = c("x", "y"))
}

View File

@ -23,6 +23,9 @@ and \code{background} (The background color of the pie).}
\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}}.
}

View File

@ -29,6 +29,9 @@ radialBar_opts(size = NULL, inverseOrder = NULL, startAngle = NULL,
\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}}.
}