apexcharter-shiny | R Documentation |
Output and render functions for using apexcharter within Shiny applications and interactive Rmd documents.
apexchartOutput(outputId, width = "100%", height = "400px")
renderApexchart(expr, env = parent.frame(), quoted = FALSE)
sparkBoxOutput(outputId, width = "100%", height = "160px")
renderSparkBox(expr, env = parent.frame(), quoted = FALSE)
outputId |
Output variable to read from. |
width , height |
Must be a valid CSS unit (like |
expr |
An expression that generates a calendar |
env |
The environment in which to evaluate |
quoted |
Is |
Output element that can be included in UI. Render function to create output in server.
To render a chart with facets (using ax_facet_wrap()
or ax_facet_grid()
) in Shiny,
see apexfacetOutput()
(in UI) and renderApexfacet()
(in Server).
if (interactive()) {
library(shiny)
library(apexcharter)
ui <- fluidPage(
fluidRow(
column(
width = 8, offset = 2,
tags$h2("Apexchart in Shiny"),
actionButton("redraw", "Redraw chart"),
apexchartOutput("chart")
)
)
)
server <- function(input, output, session) {
output$chart <- renderApexchart({
input$redraw
apexchart() %>%
ax_chart(type = "bar") %>%
ax_series(
list(
name = "Example",
data = sample(1:100, 5)
)
) %>%
ax_xaxis(
categories = LETTERS[1:5]
)
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.