apexcharter/man/apexcharter-shiny.Rd

82 lines
2.2 KiB
Plaintext
Raw Normal View History

2018-07-30 22:54:39 +02:00
% Generated by roxygen2: do not edit by hand
2020-04-16 16:42:34 +02:00
% Please edit documentation in R/apexcharter.R, R/spark-box.R
2018-07-30 22:54:39 +02:00
\name{apexcharter-shiny}
\alias{apexcharter-shiny}
2018-09-07 18:06:41 +02:00
\alias{apexchartOutput}
\alias{renderApexchart}
2020-04-16 16:42:34 +02:00
\alias{sparkBoxOutput}
\alias{renderSparkBox}
2018-07-30 22:54:39 +02:00
\title{Shiny bindings for apexcharter}
\usage{
2018-09-07 18:06:41 +02:00
apexchartOutput(outputId, width = "100\%", height = "400px")
2018-07-30 22:54:39 +02:00
2018-09-07 18:06:41 +02:00
renderApexchart(expr, env = parent.frame(), quoted = FALSE)
2020-04-16 16:42:34 +02:00
sparkBoxOutput(outputId, width = "100\%", height = "160px")
renderSparkBox(expr, env = parent.frame(), quoted = FALSE)
2018-07-30 22:54:39 +02:00
}
\arguments{
2021-11-29 18:58:47 +01:00
\item{outputId}{Output variable to read from.}
2018-07-30 22:54:39 +02:00
2021-11-29 18:58:47 +01:00
\item{width, height}{Must be a valid CSS unit (like \verb{100\%},
\verb{400px}, \code{auto}) or a number, which will be coerced to a
string and have \code{px} appended.}
2018-07-30 22:54:39 +02:00
2021-11-29 18:58:47 +01:00
\item{expr}{An expression that generates a calendar}
2018-07-30 22:54:39 +02:00
\item{env}{The environment in which to evaluate \code{expr}.}
\item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This
is useful if you want to save an expression in a variable.}
}
2019-07-24 12:20:22 +02:00
\value{
2021-11-29 18:58:47 +01:00
Output element that can be included in UI. Render function to create output in server.
2019-07-24 12:20:22 +02:00
}
2018-07-30 22:54:39 +02:00
\description{
Output and render functions for using apexcharter within Shiny
applications and interactive Rmd documents.
}
2021-11-29 18:58:47 +01:00
\note{
To render a chart with facets (using \code{\link[=ax_facet_wrap]{ax_facet_wrap()}} or \code{\link[=ax_facet_grid]{ax_facet_grid()}}) in Shiny,
see \code{\link[=apexfacetOutput]{apexfacetOutput()}} (in UI) and \code{\link[=renderApexfacet]{renderApexfacet()}} (in Server).
}
2019-07-19 14:11:41 +02:00
\examples{
if (interactive()) {
library(shiny)
2019-11-26 11:26:47 +01:00
library(apexcharter)
2019-07-19 14:11:41 +02:00
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)
}
}