diff --git a/DESCRIPTION b/DESCRIPTION index fe61fcb9..08ecfae9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: apexcharter -Version: 0.4.3 +Version: 0.4.3.9000 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/data-raw/life_expectancy.R b/data-raw/life_expectancy.R index bb4bfa26..bbfd4b36 100644 --- a/data-raw/life_expectancy.R +++ b/data-raw/life_expectancy.R @@ -16,9 +16,11 @@ life_expec_long <- life_expec_long[year %in% c(1972, 2007), list(country, year, life_expec_long <- life_expec_long[country %in% c("Botswana", "Ghana", "Iran", "Liberia", "Malaysia", "Mexico", "Nigeria", "Pakistan", "Philippines", "Zambia")] 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_long <- melt(data = life_expec, id.vars = c("country", "type"), variable.name = "year", value.name = "lifeExp") # Use data ---------------------------------------------------------------- diff --git a/data/life_expec.rda b/data/life_expec.rda index 9d1bd916..70b0c80b 100644 Binary files a/data/life_expec.rda and b/data/life_expec.rda differ diff --git a/data/life_expec_long.rda b/data/life_expec_long.rda index 96a76c35..cac1be6b 100644 Binary files a/data/life_expec_long.rda and b/data/life_expec_long.rda differ diff --git a/vignettes/apexcharter.Rmd b/vignettes/apexcharter.Rmd index 6fc9d4ff..56fd52d4 100644 --- a/vignettes/apexcharter.Rmd +++ b/vignettes/apexcharter.Rmd @@ -347,16 +347,20 @@ data("life_expec_long", package = "apexcharter") apex( life_expec_long, - mapping = aes(x = as.character(year), y = lifeExp, fill = country), + mapping = aes(x = year, y = lifeExp, fill = country), type = "slope", height = "700px" ) %>% - ax_colors("#112466") %>% + 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") ```