facet shiny examples

This commit is contained in:
pvictor 2021-01-06 11:34:27 +01:00
parent 3d55188a00
commit 1aac748555
3 changed files with 28 additions and 1 deletions

View File

@ -327,7 +327,7 @@ build_facet_tag <- function(x) {
#' @importFrom shiny uiOutput
#' @importFrom htmlwidgets getDependency
#'
#' @example examples/facet-shiny.R
#' @example examples/facet-wrap-shiny.R
apexfacetOutput <- function(outputId) {
tagList(
uiOutput(outputId = outputId),

View File

@ -0,0 +1,27 @@
library(shiny)
library(apexcharter)
data("economics_long", package = "ggplot2")
ui <- fluidPage(
tags$h2("Apexcharts Facets Example"),
apexfacetOutput("myfacet")
)
server <- function(input, output, session) {
output$myfacet <- renderApexfacet({
apex(economics_long, aes(date, value), type = "line") %>%
ax_yaxis(tickAmount = 5) %>%
ax_facet_grid(vars(variable), scales = "free", chart_height = "200px")
})
}
if (interactive())
shinyApp(ui, server)