2020-12-08 14:49:16 +01:00
|
|
|
|
|
|
|
library(shiny)
|
|
|
|
library(apexcharter)
|
|
|
|
|
|
|
|
data("unhcr_ts")
|
|
|
|
refugees <- unhcr_ts %>%
|
|
|
|
subset(population_type == "Refugees (incl. refugee-like situations)") %>%
|
|
|
|
transform(date = as.Date(paste0(year, "-01-01")))
|
|
|
|
|
|
|
|
|
|
|
|
ui <- fluidPage(
|
|
|
|
|
|
|
|
tags$h2("Apexcharts Facets Example"),
|
|
|
|
|
|
|
|
apexfacetOutput("myfacet")
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
server <- function(input, output, session) {
|
|
|
|
|
|
|
|
output$myfacet <- renderApexfacet({
|
2021-01-05 15:08:13 +01:00
|
|
|
apex(refugees, aes(date, n), type = "column") %>%
|
2020-12-08 14:49:16 +01:00
|
|
|
ax_yaxis(tickAmount = 5) %>%
|
2021-01-05 15:08:13 +01:00
|
|
|
ax_facet_wrap(vars(continent_origin), scales = "free")
|
2020-12-08 14:49:16 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-08 16:22:24 +01:00
|
|
|
if (interactive())
|
|
|
|
shinyApp(ui, server)
|
2020-12-08 14:49:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|