Compare commits

...

17 Commits

Author SHA1 Message Date
pvictor 85708897b0 v0.4.3 2024-05-15 11:23:59 +02:00
pvictor 9200d918ad fix news and version number 2024-05-15 11:07:42 +02:00
pvictor 58723475cb updated slope chart height 2024-05-13 11:52:39 +02:00
pvictor b313b45989 added slope charts 2024-05-13 11:20:25 +02:00
pvictor 7e4189366e updated ApexCharts.js to 3.49.1 2024-05-13 11:18:20 +02:00
pvictor 3a3a10369f updated life_expec data + long format 2024-05-13 11:17:46 +02:00
pvictor d0fac7c1ee Updated ApexCharts.js to 3.48.0 2024-03-20 10:25:34 +01:00
pvictor 1ac176f30c maj pkgdown + doc 2024-03-11 11:29:42 +01:00
pvictor 624ab8b901 update pkgdown 2024-03-09 12:00:13 +01:00
pvictor 57733add33 Updated ApexCharts.js to 3.47.0 2024-03-09 11:48:29 +01:00
pvictor c1560fc9c5 Updated ApexCharts.js to 3.46.0 2024-02-21 11:50:04 +01:00
dependabot[bot] e68f20930c
Bump postcss from 8.3.11 to 8.4.31 (#73)
Bumps [postcss](https://github.com/postcss/postcss) from 8.3.11 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.3.11...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-20 11:07:15 +01:00
pvictor 6cff8a9f67 updated apexcharts.js to 3.45.0 2023-12-20 11:06:46 +01:00
pvictor 1d94f9d4a6 Updated ApexCharts.js to 3.44.0 2023-10-20 10:14:59 +02:00
pvictor eb228597d8 Updated ApexCharts.js to 3.43.0 2023-10-03 09:20:13 +02:00
pvictor bbda86de93 fix heatmap xaxis (force character) 2023-08-23 10:42:59 +02:00
pvictor 467be227fc Updated ApexCharts.js to 3.41.1 2023-08-23 10:13:17 +02:00
19 changed files with 190 additions and 61 deletions

View File

@ -1,5 +1,5 @@
Package: apexcharter
Version: 0.4.1
Version: 0.4.3
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.
@ -28,7 +28,7 @@ Suggests:
scales,
rmarkdown,
covr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
URL: https://github.com/dreamRs/apexcharter, https://dreamrs.github.io/apexcharter/
BugReports: https://github.com/dreamRs/apexcharter/issues

View File

@ -107,6 +107,7 @@ importFrom(rlang,is_function)
importFrom(rlang,is_list)
importFrom(rlang,is_named)
importFrom(rlang,is_null)
importFrom(rlang,quo)
importFrom(rlang,quos)
importFrom(rlang,sym)
importFrom(rlang,syms)

15
NEWS.md
View File

@ -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
==================

View File

@ -14,7 +14,7 @@
#' `"pie"`, `"donut"`,
#' `"radialBar"`, `"radar"`, `"scatter"`,
#' `"heatmap"`, `"treemap"`,
#' `"timeline"` and `"dumbbell"`.
#' `"timeline"`, `"dumbbell"` and `"slope"`.
#' @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 serie_name Name for the serie displayed in tooltip,
@ -44,7 +44,7 @@ apex <- function(data, mapping,
choices = c(
"column", "bar",
"rangeBar", "dumbbell",
"line", "spline", "step",
"line", "spline", "step", "slope",
"area", "area-spline", "area-step",
"rangeArea",
"pie", "donut",
@ -69,7 +69,7 @@ apex <- function(data, mapping,
type <- "bubble"
}
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) {
mapdata <- compute_count(mapdata)
}
@ -179,7 +179,7 @@ make_series <- function(mapdata, mapping, type = NULL, serie_name = NULL, force_
)))
if (is_grouped(mapping)) {
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"))) {
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))
}
#' @importFrom rlang quo
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[n_mapping == "y"] <- "group"
if ("fill" %in% n_mapping) {
@ -255,7 +258,7 @@ list1 <- function(x) {
correct_type <- function(type) {
if (isTRUE(type %in% c("column"))) {
"bar"
} else if (isTRUE(type %in% c("spline", "step"))) {
} else if (isTRUE(type %in% c("spline", "step", "slope"))) {
"line"
} else if (isTRUE(type %in% c("area-spline", "area-step"))) {
"area"
@ -341,6 +344,7 @@ choose_config <- function(type, mapdata) {
"timeline" = config_timeline(),
"candlestick" = config_candlestick(),
"boxplot" = config_boxplot(horizontal = box_horiz),
"slope" = config_slope(),
list()
)
}
@ -461,3 +465,12 @@ config_boxplot <- function(horizontal = FALSE) {
)
}
config_slope <- function() {
list(
plotOptions = list(
line = list(
isSlopeChart = TRUE
)
)
)
}

View File

@ -5,9 +5,8 @@
#' to create interactive and modern SVG charts.
#'
#' @name apexcharter-package
#' @docType package
#' @author Victor Perrier (@@dreamRs_fr)
NULL
"_PACKAGE"
#' apexcharter exported operators and S3 methods
#'

View File

@ -11,7 +11,7 @@
#' \item{\code{continent_origin}}{Continent of residence of population.}
#' \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"
@ -89,3 +89,12 @@
#' @source gapminder package (\url{https://jennybc.github.io/gapminder/} and \url{https://www.gapminder.org/data/})
"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"

View File

@ -6,6 +6,9 @@ template:
bslib:
base_font: {google: "Poppins"}
primary: "#112446"
navbar-dark-color: "#FFFFFF"
secondary: "#DFDFDF"
navbar-dark-active-color: "#DFDFDF"
navbar:
bg: primary

View File

@ -9,13 +9,14 @@ library(gapminder)
# Data --------------------------------------------------------------------
life_expec <- as.data.table(gapminder::gapminder)
life_expec <- life_expec[year %in% c(1972, 2007), list(country, year, lifeExp)]
life_expec_long <- as.data.table(gapminder::gapminder)
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% 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")]
life_expec <- dcast(life_expec, country ~ year, value.var = "lifeExp")
life_expec_long[, country := as.character(country)]
life_expec <- dcast(life_expec_long, country ~ year, value.var = "lifeExp")
life_expec[, type := fifelse(`1972` > `2007`, "decreased", "increased")]
@ -25,6 +26,8 @@ life_expec[, type := fifelse(`1972` > `2007`, "decreased", "increased")]
setDF(life_expec)
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 +37,13 @@ usethis::use_data(life_expec, internal = FALSE, overwrite = TRUE, compress = "xz
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(
bar = bar_opts(
dumbbellColors = list(list("#3d85c6", "#fb6003"))
)
) %>%
ax_colors("#BABABA") %>%
) %>%
ax_colors("#BABABA") %>%
ax_labs(
title = "Life expectancy : 1972 vs. 2007",
subtitle = "Data from Gapminder dataset",
@ -49,14 +52,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_plotOptions(
bar = bar_opts(
dumbbellColors = list(list("#3d85c6", "#fb6003"), list("#3d85c6", "#fb6003"))
)
) %>%
ax_colors(c("#3d85c6", "#fb6003")) %>%
) %>%
ax_colors(c("#3d85c6", "#fb6003")) %>%
ax_labs(
title = "Life expectancy : 1972 vs. 2007",
subtitle = "Data from Gapminder dataset",

Binary file not shown.

BIN
data/life_expec_long.rda Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*!
* ApexCharts v3.41.0
* (c) 2018-2023 ApexCharts
* ApexCharts v3.49.1
* (c) 2018-2024 ApexCharts
* Released under the MIT License.
*/

View File

@ -30,7 +30,7 @@ a \code{data.frame}, it will be coerced to with \code{as.data.frame}.}
\code{"pie"}, \code{"donut"},
\code{"radialBar"}, \code{"radar"}, \code{"scatter"},
\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.}

View File

@ -2,12 +2,22 @@
% Please edit documentation in R/apexcharter-package.R
\docType{package}
\name{apexcharter-package}
\alias{apexcharter}
\alias{apexcharter-package}
\title{An \code{htmlwidget} interface to the
ApexCharts javascript chart library}
\description{
This package allow you to use ApexCharts.js (\url{https://apexcharts.com/}),
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{
Victor Perrier (@dreamRs_fr)

19
man/life_expec_long.Rd Normal file
View File

@ -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}

View File

@ -15,7 +15,7 @@ Returned IDPs, Stateless persons, Others of concern.}
}
}
\source{
UNHCR (The UN Refugee Agency) (\url{https://www.unhcr.org/})
UNHCR (The UN Refugee Agency) (\url{https://data.unhcr.org/})
}
\usage{
unhcr_ts

94
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"apexcharts": "^3.41.0",
"apexcharts": "^3.49.1",
"d3-format": "^3.0.1"
},
"devDependencies": {
@ -319,6 +319,11 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"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": {
"version": "8.8.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
@ -366,10 +371,11 @@
}
},
"node_modules/apexcharts": {
"version": "3.41.0",
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.41.0.tgz",
"integrity": "sha512-FJXA7NVjxs1q+ptR3b1I+pN8K/gWuXn+qLZjFz8EHvJOokdgcuwa/HSe5aC465HW/LWnrjWLSTsOQejQbQ42hQ==",
"version": "3.49.1",
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.49.1.tgz",
"integrity": "sha512-MqGtlq/KQuO8j0BBsUJYlRG8VBctKwYdwuBtajHgHTmSgUU3Oai+8oYN/rKCXwXzrUlYA+GiMgotAIbXY2BCGw==",
"dependencies": {
"@yr/monotone-cubic-spline": "^1.0.3",
"svg.draggable.js": "^2.2.2",
"svg.easing.js": "^2.0.0",
"svg.filter.js": "^2.0.2",
@ -911,10 +917,16 @@
}
},
"node_modules/nanoid": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz",
"integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==",
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"bin": {
"nanoid": "bin/nanoid.cjs"
},
@ -1040,21 +1052,31 @@
}
},
"node_modules/postcss": {
"version": "8.3.11",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz",
"integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==",
"version": "8.4.31",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"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": {
"nanoid": "^3.1.30",
"nanoid": "^3.3.6",
"picocolors": "^1.0.0",
"source-map-js": "^0.6.2"
"source-map-js": "^1.0.2"
},
"engines": {
"node": "^10 || ^12 || >=14"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
}
},
"node_modules/postcss-modules-extract-imports": {
@ -1310,9 +1332,9 @@
}
},
"node_modules/source-map-js": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz",
"integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==",
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true,
"engines": {
"node": ">=0.10.0"
@ -1970,6 +1992,11 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"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": {
"version": "8.8.2",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
@ -2003,10 +2030,11 @@
"requires": {}
},
"apexcharts": {
"version": "3.41.0",
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.41.0.tgz",
"integrity": "sha512-FJXA7NVjxs1q+ptR3b1I+pN8K/gWuXn+qLZjFz8EHvJOokdgcuwa/HSe5aC465HW/LWnrjWLSTsOQejQbQ42hQ==",
"version": "3.49.1",
"resolved": "https://registry.npmjs.org/apexcharts/-/apexcharts-3.49.1.tgz",
"integrity": "sha512-MqGtlq/KQuO8j0BBsUJYlRG8VBctKwYdwuBtajHgHTmSgUU3Oai+8oYN/rKCXwXzrUlYA+GiMgotAIbXY2BCGw==",
"requires": {
"@yr/monotone-cubic-spline": "^1.0.3",
"svg.draggable.js": "^2.2.2",
"svg.easing.js": "^2.0.0",
"svg.filter.js": "^2.0.2",
@ -2404,9 +2432,9 @@
"dev": true
},
"nanoid": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz",
"integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==",
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
"dev": true
},
"neo-async": {
@ -2499,14 +2527,14 @@
}
},
"postcss": {
"version": "8.3.11",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz",
"integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==",
"version": "8.4.31",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
"dev": true,
"requires": {
"nanoid": "^3.1.30",
"nanoid": "^3.3.6",
"picocolors": "^1.0.0",
"source-map-js": "^0.6.2"
"source-map-js": "^1.0.2"
}
},
"postcss-modules-extract-imports": {
@ -2682,9 +2710,9 @@
"dev": true
},
"source-map-js": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz",
"integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==",
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true
},
"source-map-support": {

View File

@ -35,7 +35,7 @@
"webpack-merge": "^5.8.0"
},
"dependencies": {
"apexcharts": "^3.41.0",
"apexcharts": "^3.49.1",
"d3-format": "^3.0.1"
}
}

View File

@ -306,10 +306,15 @@ apex(mpg, aes(hwy, class), "boxplot") %>%
ax_plotOptions(
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
Create Dumbbell chart with:
@ -331,3 +336,27 @@ 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 = as.character(year), y = lifeExp, fill = country),
type = "slope",
height = "700px"
) %>%
ax_colors("#112466") %>%
ax_labs(
title = "Life expectancy : 1972 vs. 2007",
subtitle = "Data from Gapminder dataset",
x = "Life expectancy at birth, in years"
)
```