diff --git a/DESCRIPTION b/DESCRIPTION index 262176c..ac98959 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: apexcharter -Version: 0.1.6.900 +Version: 0.1.6.910 Title: Create Interactive Chart with the JavaScript 'ApexCharts' Library Description: Provides an 'htmlwidgets' interface to 'apexcharts.js'. 'Apexcharts' is a modern JavaScript charting library to build interactive charts and visualizations with simple API. diff --git a/NEWS.md b/NEWS.md index e6b8b42..8b37fc9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,10 @@ apexcharter 0.1.7 ================== -* Updated ApexCharts.js to 3.21.0 +* Updated ApexCharts.js to 3.22.0 * New chart type: treemap, see vignette for example. +* New function `ax_colors_manual()` to set color mapping manually. +* `apex()` now accept `"polarArea` as type of chart. diff --git a/R/apex.R b/R/apex.R index 32b3464..1f14d6b 100644 --- a/R/apex.R +++ b/R/apex.R @@ -12,7 +12,8 @@ #' \code{"line"}, \code{"step"}, \code{"spline"}, #' \code{"area"}, \code{"area-step"}, \code{"area-spline"}, #' \code{"pie"}, \code{"donut"}, -#' \code{"radialBar"}, \code{"radar"}, \code{"scatter"}, \code{"heatmap"}, +#' \code{"radialBar"}, \code{"radar"}, \code{"scatter"}, +#' \code{"heatmap"}, \code{"treemap"}, #' \code{"timeline"}. #' @param ... Other arguments passed on to methods. Not currently used. #' @param auto_update In Shiny application, update existing chart @@ -50,6 +51,7 @@ apex <- function(data, mapping, type = "column", ..., "pie", "donut", "radialBar", "radar", + "polarArea", "scatter", "bubble", "heatmap", "treemap", @@ -65,7 +67,7 @@ apex <- function(data, mapping, type = "column", ..., type <- "bubble" } mapdata <- lapply(mapping, rlang::eval_tidy, data = data) - if (type %in% c("pie", "donut", "radialBar")) { + if (type %in% c("pie", "donut", "radialBar", "polarArea")) { opts <- list( chart = list(type = correct_type(type)), series = list1(mapdata$y), diff --git a/man/apex.Rd b/man/apex.Rd index b9f5082..a342917 100644 --- a/man/apex.Rd +++ b/man/apex.Rd @@ -28,7 +28,8 @@ a \code{data.frame}, it will be coerced to with \code{as.data.frame}.} \code{"line"}, \code{"step"}, \code{"spline"}, \code{"area"}, \code{"area-step"}, \code{"area-spline"}, \code{"pie"}, \code{"donut"}, -\code{"radialBar"}, \code{"radar"}, \code{"scatter"}, \code{"heatmap"}, +\code{"radialBar"}, \code{"radar"}, \code{"scatter"}, +\code{"heatmap"}, \code{"treemap"}, \code{"timeline"}.} \item{...}{Other arguments passed on to methods. Not currently used.} diff --git a/vignettes/apexcharter.Rmd b/vignettes/apexcharter.Rmd index 6aa9978..9d25d77 100644 --- a/vignettes/apexcharter.Rmd +++ b/vignettes/apexcharter.Rmd @@ -191,6 +191,20 @@ apex(data = new_mtcars, type = "radar", mapping = aes(x = model, y = value, grou ``` +## Polar area + +With some custom options for color mapping: + +```{r} +apex(mtcars, aes(rownames(mtcars), mpg), type = "polarArea") %>% + ax_legend(show = FALSE) %>% + ax_colors(col_numeric("Blues", domain = NULL)(mtcars$mpg)) %>% + ax_fill(opacity = 1) %>% + ax_stroke(width = 0) %>% + ax_tooltip(fillSeriesColor = FALSE) +``` + + ## Heatmap Create a heatmap with : @@ -218,7 +232,6 @@ Create a treemap with: data("mpg", package = "ggplot2") n_manufac <- dplyr::count(mpg, manufacturer) - apex(n_manufac, aes(x = manufacturer, y = n), "treemap") ``` @@ -228,6 +241,7 @@ apex(n_manufac, aes(x = manufacturer, y = n), "treemap") Create a candlestick chart with: ```{r} +data("candles", package = "apexcharter") apex( candles, aes(x = datetime, open = open, close = close, low = low, high = high),