Skip to content

Commit

Permalink
added polarArea to apex()
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Oct 6, 2020
1 parent 315001e commit 02560a9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -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.



Expand Down
6 changes: 4 additions & 2 deletions R/apex.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -50,6 +51,7 @@ apex <- function(data, mapping, type = "column", ...,
"pie", "donut",
"radialBar",
"radar",
"polarArea",
"scatter", "bubble",
"heatmap",
"treemap",
Expand All @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion man/apex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion vignettes/apexcharter.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down Expand Up @@ -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")
```

Expand All @@ -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),
Expand Down

0 comments on commit 02560a9

Please sign in to comment.