Output and render functions for using apexcharter faceting within Shiny applications and interactive Rmd documents.
apexfacetOutput(outputId)
renderApexfacet(expr, env = parent.frame(), quoted = FALSE)
output variable to read from
An expression that generates a apexcharter facet.
The environment in which to evaluate expr
.
Is expr
a quoted expression (with quote()
)? This
is useful if you want to save an expression in a variable.
An Apexcharts output that can be included in the application UI.
library(shiny)
#> Warning: le package 'shiny' a été compilé avec la version R 4.1.1
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({
apex(refugees, aes(date, n), type = "column") %>%
ax_yaxis(tickAmount = 5) %>%
ax_facet_wrap(vars(continent_origin), scales = "free")
})
}
if (interactive())
shinyApp(ui, server)