Compare commits
18 Commits
Author | SHA1 | Date |
---|---|---|
pvictor | 5f8389ff34 | |
pvictor | 85708897b0 | |
pvictor | 9200d918ad | |
pvictor | 58723475cb | |
pvictor | b313b45989 | |
pvictor | 7e4189366e | |
pvictor | 3a3a10369f | |
pvictor | d0fac7c1ee | |
pvictor | 1ac176f30c | |
pvictor | 624ab8b901 | |
pvictor | 57733add33 | |
pvictor | c1560fc9c5 | |
dependabot[bot] | e68f20930c | |
pvictor | 6cff8a9f67 | |
pvictor | 1d94f9d4a6 | |
pvictor | eb228597d8 | |
pvictor | bbda86de93 | |
pvictor | 467be227fc |
|
@ -1,5 +1,5 @@
|
||||||
Package: apexcharter
|
Package: apexcharter
|
||||||
Version: 0.4.1
|
Version: 0.4.3.9000
|
||||||
Title: Create Interactive Chart with the JavaScript 'ApexCharts' Library
|
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' is a modern JavaScript charting library to build interactive charts and visualizations with simple API.
|
||||||
|
@ -28,7 +28,7 @@ Suggests:
|
||||||
scales,
|
scales,
|
||||||
rmarkdown,
|
rmarkdown,
|
||||||
covr
|
covr
|
||||||
RoxygenNote: 7.2.3
|
RoxygenNote: 7.3.1
|
||||||
Roxygen: list(markdown = TRUE)
|
Roxygen: list(markdown = TRUE)
|
||||||
URL: https://github.com/dreamRs/apexcharter, https://dreamrs.github.io/apexcharter/
|
URL: https://github.com/dreamRs/apexcharter, https://dreamrs.github.io/apexcharter/
|
||||||
BugReports: https://github.com/dreamRs/apexcharter/issues
|
BugReports: https://github.com/dreamRs/apexcharter/issues
|
||||||
|
|
|
@ -107,6 +107,7 @@ importFrom(rlang,is_function)
|
||||||
importFrom(rlang,is_list)
|
importFrom(rlang,is_list)
|
||||||
importFrom(rlang,is_named)
|
importFrom(rlang,is_named)
|
||||||
importFrom(rlang,is_null)
|
importFrom(rlang,is_null)
|
||||||
|
importFrom(rlang,quo)
|
||||||
importFrom(rlang,quos)
|
importFrom(rlang,quos)
|
||||||
importFrom(rlang,sym)
|
importFrom(rlang,sym)
|
||||||
importFrom(rlang,syms)
|
importFrom(rlang,syms)
|
||||||
|
|
15
NEWS.md
15
NEWS.md
|
@ -1,3 +1,18 @@
|
||||||
|
apexcharter 0.4.3
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Updated ApexCharts.js to 3.49.1 (see https://github.com/apexcharts/apexcharts.js/releases).
|
||||||
|
* New chart type : slope charts.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
apexcharter 0.4.2
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Updated ApexCharts.js to 3.46.0 (see https://github.com/apexcharts/apexcharts.js/releases).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apexcharter 0.4.1
|
apexcharter 0.4.1
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
|
25
R/apex.R
25
R/apex.R
|
@ -14,7 +14,7 @@
|
||||||
#' `"pie"`, `"donut"`,
|
#' `"pie"`, `"donut"`,
|
||||||
#' `"radialBar"`, `"radar"`, `"scatter"`,
|
#' `"radialBar"`, `"radar"`, `"scatter"`,
|
||||||
#' `"heatmap"`, `"treemap"`,
|
#' `"heatmap"`, `"treemap"`,
|
||||||
#' `"timeline"` and `"dumbbell"`.
|
#' `"timeline"`, `"dumbbell"` and `"slope"`.
|
||||||
#' @param ... Other arguments passed on to methods. Not currently used.
|
#' @param ... Other arguments passed on to methods. Not currently used.
|
||||||
#' @param synchronize Give a common id to charts to synchronize them (tooltip and zoom).
|
#' @param synchronize Give a common id to charts to synchronize them (tooltip and zoom).
|
||||||
#' @param serie_name Name for the serie displayed in tooltip,
|
#' @param serie_name Name for the serie displayed in tooltip,
|
||||||
|
@ -44,7 +44,7 @@ apex <- function(data, mapping,
|
||||||
choices = c(
|
choices = c(
|
||||||
"column", "bar",
|
"column", "bar",
|
||||||
"rangeBar", "dumbbell",
|
"rangeBar", "dumbbell",
|
||||||
"line", "spline", "step",
|
"line", "spline", "step", "slope",
|
||||||
"area", "area-spline", "area-step",
|
"area", "area-spline", "area-step",
|
||||||
"rangeArea",
|
"rangeArea",
|
||||||
"pie", "donut",
|
"pie", "donut",
|
||||||
|
@ -69,7 +69,7 @@ apex <- function(data, mapping,
|
||||||
type <- "bubble"
|
type <- "bubble"
|
||||||
}
|
}
|
||||||
mapdata <- lapply(mapping, rlang::eval_tidy, data = data)
|
mapdata <- lapply(mapping, rlang::eval_tidy, data = data)
|
||||||
type_no_compute <- c("candlestick", "boxplot", "timeline", "heatmap", "rangeArea", "rangeBar", "dumbbell")
|
type_no_compute <- c("candlestick", "boxplot", "timeline", "heatmap", "rangeArea", "rangeBar", "dumbbell", "slope")
|
||||||
if (is.null(mapdata$y) & !type %in% type_no_compute) {
|
if (is.null(mapdata$y) & !type %in% type_no_compute) {
|
||||||
mapdata <- compute_count(mapdata)
|
mapdata <- compute_count(mapdata)
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ make_series <- function(mapdata, mapping, type = NULL, serie_name = NULL, force_
|
||||||
)))
|
)))
|
||||||
if (is_grouped(mapping)) {
|
if (is_grouped(mapping)) {
|
||||||
mapdata <- rename_aes(mapdata)
|
mapdata <- rename_aes(mapdata)
|
||||||
len_grp <- tapply(mapdata$group, mapdata$group, length)
|
len_grp <- tapply(as.character(mapdata$group), as.character(mapdata$group), length)
|
||||||
if (length(unique(len_grp)) > 1 & !isTRUE(type %in% c("scatter", "bubble"))) {
|
if (length(unique(len_grp)) > 1 & !isTRUE(type %in% c("scatter", "bubble"))) {
|
||||||
warning("apex: all groups must have same length! You can use `tidyr::complete` for this.")
|
warning("apex: all groups must have same length! You can use `tidyr::complete` for this.")
|
||||||
}
|
}
|
||||||
|
@ -212,8 +212,11 @@ is_sized <- function(x) {
|
||||||
any(c("size", "z") %in% names(x))
|
any(c("size", "z") %in% names(x))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' @importFrom rlang quo
|
||||||
rename_aes_heatmap <- function(mapping) {
|
rename_aes_heatmap <- function(mapping) {
|
||||||
|
if (is.null(mapping["x"]))
|
||||||
|
stop("apex(..., type = 'heatmap') must have an 'x' aesthetic", call. = FALSE)
|
||||||
|
mapping[["x"]] <- quo(as.character(!!mapping[["x"]]))
|
||||||
n_mapping <- names(mapping)
|
n_mapping <- names(mapping)
|
||||||
n_mapping[n_mapping == "y"] <- "group"
|
n_mapping[n_mapping == "y"] <- "group"
|
||||||
if ("fill" %in% n_mapping) {
|
if ("fill" %in% n_mapping) {
|
||||||
|
@ -255,7 +258,7 @@ list1 <- function(x) {
|
||||||
correct_type <- function(type) {
|
correct_type <- function(type) {
|
||||||
if (isTRUE(type %in% c("column"))) {
|
if (isTRUE(type %in% c("column"))) {
|
||||||
"bar"
|
"bar"
|
||||||
} else if (isTRUE(type %in% c("spline", "step"))) {
|
} else if (isTRUE(type %in% c("spline", "step", "slope"))) {
|
||||||
"line"
|
"line"
|
||||||
} else if (isTRUE(type %in% c("area-spline", "area-step"))) {
|
} else if (isTRUE(type %in% c("area-spline", "area-step"))) {
|
||||||
"area"
|
"area"
|
||||||
|
@ -341,6 +344,7 @@ choose_config <- function(type, mapdata) {
|
||||||
"timeline" = config_timeline(),
|
"timeline" = config_timeline(),
|
||||||
"candlestick" = config_candlestick(),
|
"candlestick" = config_candlestick(),
|
||||||
"boxplot" = config_boxplot(horizontal = box_horiz),
|
"boxplot" = config_boxplot(horizontal = box_horiz),
|
||||||
|
"slope" = config_slope(),
|
||||||
list()
|
list()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -461,3 +465,12 @@ config_boxplot <- function(horizontal = FALSE) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config_slope <- function() {
|
||||||
|
list(
|
||||||
|
plotOptions = list(
|
||||||
|
line = list(
|
||||||
|
isSlopeChart = TRUE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
#' to create interactive and modern SVG charts.
|
#' to create interactive and modern SVG charts.
|
||||||
#'
|
#'
|
||||||
#' @name apexcharter-package
|
#' @name apexcharter-package
|
||||||
#' @docType package
|
|
||||||
#' @author Victor Perrier (@@dreamRs_fr)
|
#' @author Victor Perrier (@@dreamRs_fr)
|
||||||
NULL
|
"_PACKAGE"
|
||||||
|
|
||||||
#' apexcharter exported operators and S3 methods
|
#' apexcharter exported operators and S3 methods
|
||||||
#'
|
#'
|
||||||
|
|
11
R/data.R
11
R/data.R
|
@ -11,7 +11,7 @@
|
||||||
#' \item{\code{continent_origin}}{Continent of residence of population.}
|
#' \item{\code{continent_origin}}{Continent of residence of population.}
|
||||||
#' \item{\code{n}}{Number of people concerned.}
|
#' \item{\code{n}}{Number of people concerned.}
|
||||||
#' }
|
#' }
|
||||||
#' @source UNHCR (The UN Refugee Agency) (\url{https://www.unhcr.org/})
|
#' @source UNHCR (The UN Refugee Agency) (\url{https://data.unhcr.org/})
|
||||||
"unhcr_ts"
|
"unhcr_ts"
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,3 +89,12 @@
|
||||||
#' @source gapminder package (\url{https://jennybc.github.io/gapminder/} and \url{https://www.gapminder.org/data/})
|
#' @source gapminder package (\url{https://jennybc.github.io/gapminder/} and \url{https://www.gapminder.org/data/})
|
||||||
"life_expec"
|
"life_expec"
|
||||||
|
|
||||||
|
#' @title Life expectancy data (long format)
|
||||||
|
#'
|
||||||
|
#' @description The dataset contains data about life expectancy in 1972 and 2007 for 10 countries.
|
||||||
|
#'
|
||||||
|
#' @format A data frame with 20 observations and 3 variables.
|
||||||
|
#'
|
||||||
|
#' @source gapminder package (\url{https://jennybc.github.io/gapminder/} and \url{https://www.gapminder.org/data/})
|
||||||
|
"life_expec_long"
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,9 @@ template:
|
||||||
bslib:
|
bslib:
|
||||||
base_font: {google: "Poppins"}
|
base_font: {google: "Poppins"}
|
||||||
primary: "#112446"
|
primary: "#112446"
|
||||||
|
navbar-dark-color: "#FFFFFF"
|
||||||
|
secondary: "#DFDFDF"
|
||||||
|
navbar-dark-active-color: "#DFDFDF"
|
||||||
|
|
||||||
navbar:
|
navbar:
|
||||||
bg: primary
|
bg: primary
|
||||||
|
|
|
@ -9,15 +9,18 @@ library(gapminder)
|
||||||
|
|
||||||
# Data --------------------------------------------------------------------
|
# Data --------------------------------------------------------------------
|
||||||
|
|
||||||
life_expec <- as.data.table(gapminder::gapminder)
|
life_expec_long <- as.data.table(gapminder::gapminder)
|
||||||
life_expec <- life_expec[year %in% c(1972, 2007), list(country, year, lifeExp)]
|
life_expec_long <- life_expec_long[year %in% c(1972, 2007), list(country, year, lifeExp)]
|
||||||
|
|
||||||
# life_expec <- life_expec[country %in% sample(unique(country), 10)]
|
# life_expec <- life_expec[country %in% sample(unique(country), 10)]
|
||||||
life_expec <- life_expec[country %in% c("Botswana", "Ghana", "Iran", "Liberia", "Malaysia", "Mexico",
|
life_expec_long <- life_expec_long[country %in% c("Botswana", "Ghana", "Iran", "Liberia", "Malaysia", "Mexico",
|
||||||
"Nigeria", "Pakistan", "Philippines", "Zambia")]
|
"Nigeria", "Pakistan", "Philippines", "Zambia")]
|
||||||
life_expec <- dcast(life_expec, country ~ year, value.var = "lifeExp")
|
life_expec_long[, country := as.character(country)]
|
||||||
|
life_expec_long[, lifeExp := round(lifeExp, 1)]
|
||||||
|
life_expec <- dcast(life_expec_long, country ~ year, value.var = "lifeExp")
|
||||||
life_expec[, type := fifelse(`1972` > `2007`, "decreased", "increased")]
|
life_expec[, type := fifelse(`1972` > `2007`, "decreased", "increased")]
|
||||||
|
|
||||||
|
life_expec_long <- melt(data = life_expec, id.vars = c("country", "type"), variable.name = "year", value.name = "lifeExp")
|
||||||
|
|
||||||
|
|
||||||
# Use data ----------------------------------------------------------------
|
# Use data ----------------------------------------------------------------
|
||||||
|
@ -25,6 +28,8 @@ life_expec[, type := fifelse(`1972` > `2007`, "decreased", "increased")]
|
||||||
setDF(life_expec)
|
setDF(life_expec)
|
||||||
usethis::use_data(life_expec, internal = FALSE, overwrite = TRUE, compress = "xz")
|
usethis::use_data(life_expec, internal = FALSE, overwrite = TRUE, compress = "xz")
|
||||||
|
|
||||||
|
setDF(life_expec_long)
|
||||||
|
usethis::use_data(life_expec_long, internal = FALSE, overwrite = TRUE, compress = "xz")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,13 +39,13 @@ usethis::use_data(life_expec, internal = FALSE, overwrite = TRUE, compress = "xz
|
||||||
|
|
||||||
pkgload::load_all()
|
pkgload::load_all()
|
||||||
|
|
||||||
apex(life_expec, aes(country, x = `1972`, xend = `2007`), type = "dumbbell") %>%
|
apex(life_expec, aes(country, x = `1972`, xend = `2007`), type = "dumbbell") %>%
|
||||||
ax_plotOptions(
|
ax_plotOptions(
|
||||||
bar = bar_opts(
|
bar = bar_opts(
|
||||||
dumbbellColors = list(list("#3d85c6", "#fb6003"))
|
dumbbellColors = list(list("#3d85c6", "#fb6003"))
|
||||||
)
|
)
|
||||||
) %>%
|
) %>%
|
||||||
ax_colors("#BABABA") %>%
|
ax_colors("#BABABA") %>%
|
||||||
ax_labs(
|
ax_labs(
|
||||||
title = "Life expectancy : 1972 vs. 2007",
|
title = "Life expectancy : 1972 vs. 2007",
|
||||||
subtitle = "Data from Gapminder dataset",
|
subtitle = "Data from Gapminder dataset",
|
||||||
|
@ -49,14 +54,14 @@ apex(life_expec, aes(country, x = `1972`, xend = `2007`), type = "dumbbell") %>%
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apex(life_expec, aes(country, x = `1972`, xend = `2007`, group = type), type = "dumbbell") %>%
|
apex(life_expec, aes(country, x = `1972`, xend = `2007`, group = type), type = "dumbbell") %>%
|
||||||
ax_xaxis(type = "category", categories = unique(life_expec$country)) %>%
|
ax_xaxis(type = "category", categories = unique(life_expec$country)) %>%
|
||||||
ax_plotOptions(
|
ax_plotOptions(
|
||||||
bar = bar_opts(
|
bar = bar_opts(
|
||||||
dumbbellColors = list(list("#3d85c6", "#fb6003"), list("#3d85c6", "#fb6003"))
|
dumbbellColors = list(list("#3d85c6", "#fb6003"), list("#3d85c6", "#fb6003"))
|
||||||
)
|
)
|
||||||
) %>%
|
) %>%
|
||||||
ax_colors(c("#3d85c6", "#fb6003")) %>%
|
ax_colors(c("#3d85c6", "#fb6003")) %>%
|
||||||
ax_labs(
|
ax_labs(
|
||||||
title = "Life expectancy : 1972 vs. 2007",
|
title = "Life expectancy : 1972 vs. 2007",
|
||||||
subtitle = "Data from Gapminder dataset",
|
subtitle = "Data from Gapminder dataset",
|
||||||
|
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
/*!
|
/*!
|
||||||
* ApexCharts v3.41.0
|
* ApexCharts v3.49.1
|
||||||
* (c) 2018-2023 ApexCharts
|
* (c) 2018-2024 ApexCharts
|
||||||
* Released under the MIT License.
|
* Released under the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ a \code{data.frame}, it will be coerced to with \code{as.data.frame}.}
|
||||||
\code{"pie"}, \code{"donut"},
|
\code{"pie"}, \code{"donut"},
|
||||||
\code{"radialBar"}, \code{"radar"}, \code{"scatter"},
|
\code{"radialBar"}, \code{"radar"}, \code{"scatter"},
|
||||||
\code{"heatmap"}, \code{"treemap"},
|
\code{"heatmap"}, \code{"treemap"},
|
||||||
\code{"timeline"} and \code{"dumbbell"}.}
|
\code{"timeline"}, \code{"dumbbell"} and \code{"slope"}.}
|
||||||
|
|
||||||
\item{...}{Other arguments passed on to methods. Not currently used.}
|
\item{...}{Other arguments passed on to methods. Not currently used.}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,22 @@
|
||||||
% Please edit documentation in R/apexcharter-package.R
|
% Please edit documentation in R/apexcharter-package.R
|
||||||
\docType{package}
|
\docType{package}
|
||||||
\name{apexcharter-package}
|
\name{apexcharter-package}
|
||||||
|
\alias{apexcharter}
|
||||||
\alias{apexcharter-package}
|
\alias{apexcharter-package}
|
||||||
\title{An \code{htmlwidget} interface to the
|
\title{An \code{htmlwidget} interface to the
|
||||||
ApexCharts javascript chart library}
|
ApexCharts javascript chart library}
|
||||||
\description{
|
\description{
|
||||||
This package allow you to use ApexCharts.js (\url{https://apexcharts.com/}),
|
This package allow you to use ApexCharts.js (\url{https://apexcharts.com/}),
|
||||||
to create interactive and modern SVG charts.
|
to create interactive and modern SVG charts.
|
||||||
|
}
|
||||||
|
\seealso{
|
||||||
|
Useful links:
|
||||||
|
\itemize{
|
||||||
|
\item \url{https://github.com/dreamRs/apexcharter}
|
||||||
|
\item \url{https://dreamrs.github.io/apexcharter/}
|
||||||
|
\item Report bugs at \url{https://github.com/dreamRs/apexcharter/issues}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
\author{
|
\author{
|
||||||
Victor Perrier (@dreamRs_fr)
|
Victor Perrier (@dreamRs_fr)
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
% Generated by roxygen2: do not edit by hand
|
||||||
|
% Please edit documentation in R/data.R
|
||||||
|
\docType{data}
|
||||||
|
\name{life_expec_long}
|
||||||
|
\alias{life_expec_long}
|
||||||
|
\title{Life expectancy data (long format)}
|
||||||
|
\format{
|
||||||
|
A data frame with 20 observations and 3 variables.
|
||||||
|
}
|
||||||
|
\source{
|
||||||
|
gapminder package (\url{https://jennybc.github.io/gapminder/} and \url{https://www.gapminder.org/data/})
|
||||||
|
}
|
||||||
|
\usage{
|
||||||
|
life_expec_long
|
||||||
|
}
|
||||||
|
\description{
|
||||||
|
The dataset contains data about life expectancy in 1972 and 2007 for 10 countries.
|
||||||
|
}
|
||||||
|
\keyword{datasets}
|
|
@ -15,7 +15,7 @@ Returned IDPs, Stateless persons, Others of concern.}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\source{
|
\source{
|
||||||
UNHCR (The UN Refugee Agency) (\url{https://www.unhcr.org/})
|
UNHCR (The UN Refugee Agency) (\url{https://data.unhcr.org/})
|
||||||
}
|
}
|
||||||
\usage{
|
\usage{
|
||||||
unhcr_ts
|
unhcr_ts
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"apexcharts": "^3.41.0",
|
"apexcharts": "^3.49.1",
|
||||||
"d3-format": "^3.0.1"
|
"d3-format": "^3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -319,6 +319,11 @@
|
||||||
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
|
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@yr/monotone-cubic-spline": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@yr/monotone-cubic-spline/-/monotone-cubic-spline-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-FQXkOta0XBSUPHndIKON2Y9JeQz5ZeMqLYZVVK93FliNBFm7LNMIZmY6FrMEB9XPcDbE2bekMbZD6kzDkxwYjA=="
|
||||||
|
},
|
||||||
"node_modules/acorn": {
|
"node_modules/acorn": {
|
||||||
"version": "8.8.2",
|
"version": "8.8.2",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
||||||
|
@ -366,10 +371,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/apexcharts": {
|
"node_modules/apexcharts": {
|
||||||
"version": "3.41.0",
|
"version": "3.49.1",
|
||||||
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.49.1.tgz",
|
||||||
"integrity": "sha512-FJXA7NVjxs1q+ptR3b1I+pN8K/gWuXn+qLZjFz8EHvJOokdgcuwa/HSe5aC465HW/LWnrjWLSTsOQejQbQ42hQ==",
|
"integrity": "sha512-MqGtlq/KQuO8j0BBsUJYlRG8VBctKwYdwuBtajHgHTmSgUU3Oai+8oYN/rKCXwXzrUlYA+GiMgotAIbXY2BCGw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@yr/monotone-cubic-spline": "^1.0.3",
|
||||||
"svg.draggable.js": "^2.2.2",
|
"svg.draggable.js": "^2.2.2",
|
||||||
"svg.easing.js": "^2.0.0",
|
"svg.easing.js": "^2.0.0",
|
||||||
"svg.filter.js": "^2.0.2",
|
"svg.filter.js": "^2.0.2",
|
||||||
|
@ -911,10 +917,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/nanoid": {
|
"node_modules/nanoid": {
|
||||||
"version": "3.2.0",
|
"version": "3.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
|
||||||
"integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==",
|
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
"nanoid": "bin/nanoid.cjs"
|
"nanoid": "bin/nanoid.cjs"
|
||||||
},
|
},
|
||||||
|
@ -1040,21 +1052,31 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.3.11",
|
"version": "8.4.31",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||||
"integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==",
|
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/postcss/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tidelift",
|
||||||
|
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.1.30",
|
"nanoid": "^3.3.6",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"source-map-js": "^0.6.2"
|
"source-map-js": "^1.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^10 || ^12 || >=14"
|
"node": "^10 || ^12 || >=14"
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/postcss/"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/postcss-modules-extract-imports": {
|
"node_modules/postcss-modules-extract-imports": {
|
||||||
|
@ -1310,9 +1332,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "0.6.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||||
"integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==",
|
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
|
@ -1970,6 +1992,11 @@
|
||||||
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
|
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@yr/monotone-cubic-spline": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@yr/monotone-cubic-spline/-/monotone-cubic-spline-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-FQXkOta0XBSUPHndIKON2Y9JeQz5ZeMqLYZVVK93FliNBFm7LNMIZmY6FrMEB9XPcDbE2bekMbZD6kzDkxwYjA=="
|
||||||
|
},
|
||||||
"acorn": {
|
"acorn": {
|
||||||
"version": "8.8.2",
|
"version": "8.8.2",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
||||||
|
@ -2003,10 +2030,11 @@
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"apexcharts": {
|
"apexcharts": {
|
||||||
"version": "3.41.0",
|
"version": "3.49.1",
|
||||||
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.49.1.tgz",
|
||||||
"integrity": "sha512-FJXA7NVjxs1q+ptR3b1I+pN8K/gWuXn+qLZjFz8EHvJOokdgcuwa/HSe5aC465HW/LWnrjWLSTsOQejQbQ42hQ==",
|
"integrity": "sha512-MqGtlq/KQuO8j0BBsUJYlRG8VBctKwYdwuBtajHgHTmSgUU3Oai+8oYN/rKCXwXzrUlYA+GiMgotAIbXY2BCGw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"@yr/monotone-cubic-spline": "^1.0.3",
|
||||||
"svg.draggable.js": "^2.2.2",
|
"svg.draggable.js": "^2.2.2",
|
||||||
"svg.easing.js": "^2.0.0",
|
"svg.easing.js": "^2.0.0",
|
||||||
"svg.filter.js": "^2.0.2",
|
"svg.filter.js": "^2.0.2",
|
||||||
|
@ -2404,9 +2432,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"nanoid": {
|
"nanoid": {
|
||||||
"version": "3.2.0",
|
"version": "3.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
|
||||||
"integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==",
|
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"neo-async": {
|
"neo-async": {
|
||||||
|
@ -2499,14 +2527,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"postcss": {
|
"postcss": {
|
||||||
"version": "8.3.11",
|
"version": "8.4.31",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||||
"integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==",
|
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"nanoid": "^3.1.30",
|
"nanoid": "^3.3.6",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"source-map-js": "^0.6.2"
|
"source-map-js": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"postcss-modules-extract-imports": {
|
"postcss-modules-extract-imports": {
|
||||||
|
@ -2682,9 +2710,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"source-map-js": {
|
"source-map-js": {
|
||||||
"version": "0.6.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||||
"integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==",
|
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"source-map-support": {
|
"source-map-support": {
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
"webpack-merge": "^5.8.0"
|
"webpack-merge": "^5.8.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"apexcharts": "^3.41.0",
|
"apexcharts": "^3.49.1",
|
||||||
"d3-format": "^3.0.1"
|
"d3-format": "^3.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,10 +306,15 @@ apex(mpg, aes(hwy, class), "boxplot") %>%
|
||||||
ax_plotOptions(
|
ax_plotOptions(
|
||||||
boxPlot = boxplot_opts(color.upper = "#8BB0A6", color.lower = "#8BB0A6" )
|
boxPlot = boxplot_opts(color.upper = "#8BB0A6", color.lower = "#8BB0A6" )
|
||||||
) %>%
|
) %>%
|
||||||
ax_stroke(colors = list("#2A5769"))
|
ax_stroke(colors = list("#2A5769")) %>%
|
||||||
|
ax_grid(
|
||||||
|
xaxis = list(lines = list(show = TRUE)),
|
||||||
|
yaxis = list(lines = list(show = FALSE))
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Dumbbell charts
|
## Dumbbell charts
|
||||||
|
|
||||||
Create Dumbbell chart with:
|
Create Dumbbell chart with:
|
||||||
|
@ -331,3 +336,31 @@ apex(life_expec, aes(country, x = `1972`, xend = `2007`), type = "dumbbell") %>%
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Slope charts
|
||||||
|
|
||||||
|
Create a slope chart with:
|
||||||
|
|
||||||
|
```{r slope}
|
||||||
|
data("life_expec_long", package = "apexcharter")
|
||||||
|
|
||||||
|
apex(
|
||||||
|
life_expec_long,
|
||||||
|
mapping = aes(x = year, y = lifeExp, fill = country),
|
||||||
|
type = "slope",
|
||||||
|
height = "700px"
|
||||||
|
) %>%
|
||||||
|
ax_chart(animations = list(enabled = FALSE)) %>%
|
||||||
|
# aurora nord12 = #d08770 / aurora nord14 = #a3be8c -> darken colorspace::darken(, amount = 0.3)
|
||||||
|
ax_colors(ifelse(unique(life_expec_long[, c("country", "type")])$type == "decreased", "#955945", "#6A8354")) %>%
|
||||||
|
ax_labs(
|
||||||
|
title = "Life expectancy : 1972 vs. 2007",
|
||||||
|
subtitle = "Data from Gapminder dataset",
|
||||||
|
x = "Life expectancy at birth, in years"
|
||||||
|
) %>%
|
||||||
|
# ax_dataLabels(enabled = FALSE) %>% # show or note the labels + values
|
||||||
|
ax_xaxis(position = "bottom")
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue