added polarArea to apex()
This commit is contained in:
parent
315001e883
commit
02560a95a0
|
@ -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.
|
||||
|
|
4
NEWS.md
4
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.
|
||||
|
||||
|
||||
|
||||
|
|
6
R/apex.R
6
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),
|
||||
|
|
|
@ -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.}
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue