apexcharter/man/ax_proxy_options.Rd

72 lines
1.5 KiB
Plaintext
Raw Normal View History

2019-07-19 16:00:10 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/proxy.R
\name{ax_proxy_options}
\alias{ax_proxy_options}
\title{Proxy for updating options}
\usage{
ax_proxy_options(proxy, options)
}
\arguments{
\item{proxy}{A \code{apexchartProxy} \code{htmlwidget} object.}
\item{options}{New options to set.}
}
\description{
Allows you to update the configuration object.
}
\examples{
if (interactive()) {
library(shiny)
2021-02-11 21:52:55 +01:00
2019-07-19 16:00:10 +02:00
ui <- fluidPage(
fluidRow(
column(
width = 8, offset = 2,
tags$h2("Update options"),
apexchartOutput(outputId = "chart"),
checkboxInput(
inputId = "show_label_xaxis",
label = "Show x-axis labels"
),
textInput(
inputId = "yaxis_title",
label = "Y-axis title"
)
)
)
)
server <- function(input, output, session) {
2021-02-11 21:52:55 +01:00
2019-07-19 16:00:10 +02:00
output$chart <- renderApexchart({
apexchart() \%>\%
2021-02-11 21:52:55 +01:00
ax_chart(type = "bar") \%>\%
2019-07-19 16:00:10 +02:00
ax_series(list(
name = "Example",
data = c(23, 43, 76, 31)
2021-02-11 21:52:55 +01:00
)) \%>\%
2019-07-19 16:00:10 +02:00
ax_xaxis(
categories = c("Label A", "Label B",
"Label C", "Label D")
)
})
2021-02-11 21:52:55 +01:00
2019-07-19 16:00:10 +02:00
observe({
apexchartProxy("chart") \%>\%
ax_proxy_options(list(
xaxis = list(
labels = list(show = input$show_label_xaxis)
),
yaxis = list(
title = list(text = input$yaxis_title)
)
))
})
2021-02-11 21:52:55 +01:00
2019-07-19 16:00:10 +02:00
}
2021-02-11 21:52:55 +01:00
2019-07-19 16:00:10 +02:00
shinyApp(ui, server)
}
}