apexcharter/man/ax_chart.Rd

191 lines
4.3 KiB
Plaintext
Raw Normal View History

2018-07-31 22:56:51 +02:00
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/apex-utils.R
\name{ax_chart}
\alias{ax_chart}
\title{Chart parameters}
\usage{
2019-11-26 10:17:42 +01:00
ax_chart(
ax,
type = NULL,
stacked = NULL,
stackType = NULL,
2019-11-26 14:44:59 +01:00
defaultLocale = NULL,
locales = NULL,
2019-11-26 10:17:42 +01:00
animations = NULL,
background = NULL,
foreColor = NULL,
dropShadow = NULL,
events = NULL,
offsetX = NULL,
offsetY = NULL,
selection = NULL,
sparkline = NULL,
toolbar = NULL,
zoom = NULL,
width = NULL,
height = NULL,
...
)
2018-07-31 22:56:51 +02:00
}
\arguments{
\item{ax}{An \code{\link[=apexchart]{apexchart()}} \code{htmlwidget} object.}
2018-07-31 22:56:51 +02:00
\item{type}{Specify the chart type. Available Options: \code{"bar"}, \code{"column"}, \code{"line"},
2019-02-17 22:07:04 +01:00
\code{"pie"}, \code{"donut"}, \code{"radialBar"}, \code{"scatter"}, \code{"bubble"}, \code{"heatmap"}.}
2018-07-31 22:56:51 +02:00
\item{stacked}{Logical. Enables stacked option for axis charts.}
2019-11-26 14:44:59 +01:00
\item{stackType}{When stacked, should the stacking be percentage based or normal stacking.
Available options: \code{"normal"} or \code{"100\%"}.}
2020-04-28 11:15:33 +02:00
\item{defaultLocale}{Locale to use : \code{"ca"}, \code{"cs"}, \code{"de"},
\code{"el"}, \code{"en"}, \code{"es"}, \code{"fi"}, \code{"fr"}, \code{"he"},
\code{"hi"}, \code{"hr"}, \code{"hy"}, \code{"id"}, \code{"it"}, \code{"ko"},
\code{"lt"}, \code{"nb"}, \code{"nl"}, \code{"pl"}, \code{"pt-br"}, \code{"pt"},
\code{"ru"}, \code{"se"}, \code{"sk"}, \code{"sl"}, \code{"th"}, \code{"tr"},
\code{"ua"}.}
2019-11-26 14:44:59 +01:00
2019-11-27 23:17:23 +01:00
\item{locales}{Array of custom locales parameters.}
2018-08-08 10:48:03 +02:00
2018-09-03 23:52:53 +02:00
\item{animations}{A list of parameters.}
2018-07-31 22:56:51 +02:00
\item{background}{Background color for the chart area. If you want to set background with css, use \code{.apexcharts-canvas} to set it.}
\item{foreColor}{Sets the text color for the chart. Defaults to \code{#373d3f}.}
2018-09-03 23:52:53 +02:00
\item{dropShadow}{A list of parameters. See \url{https://apexcharts.com/docs/options/chart/dropshadow/}.}
2018-07-31 22:56:51 +02:00
2019-02-17 22:07:04 +01:00
\item{events}{See \code{\link{events_opts}}.}
2018-07-31 22:56:51 +02:00
2018-09-03 23:52:53 +02:00
\item{offsetX}{Sets the left offset for chart.}
2018-07-31 22:56:51 +02:00
2018-09-03 23:52:53 +02:00
\item{offsetY}{Sets the top offset for chart.}
2018-07-31 22:56:51 +02:00
2018-09-03 23:52:53 +02:00
\item{selection}{A list of parameters.}
2018-07-31 22:56:51 +02:00
\item{sparkline}{List. Sparkline hides all the elements of the charts other than the primary paths. Helps to visualize data in small areas. .}
2018-09-03 23:52:53 +02:00
\item{toolbar}{A list of parameters. See \url{https://apexcharts.com/docs/options/chart/toolbar/}.}
2018-08-08 10:48:03 +02:00
2018-09-03 23:52:53 +02:00
\item{zoom}{A list of parameters. See \url{https://apexcharts.com/docs/options/chart/zoom/}.}
2018-07-31 22:56:51 +02:00
\item{width}{Width of the chart.}
\item{height}{Height of the chart.}
\item{...}{Additional parameters.}
}
\value{
An \code{\link[=apexchart]{apexchart()}} \code{htmlwidget} object.
2018-07-31 22:56:51 +02:00
}
\description{
Chart parameters
}
2019-06-24 15:18:38 +02:00
\examples{
2021-01-15 10:53:51 +01:00
library(apexcharter)
2019-06-24 15:18:38 +02:00
data("diamonds", package = "ggplot2")
2020-03-03 19:34:07 +01:00
## Stack bar type
# default is dodge
apex(
2021-01-15 10:53:51 +01:00
data = diamonds,
mapping = aes(x = cut, fill = color)
2020-03-03 19:34:07 +01:00
)
# stack
2019-06-24 15:18:38 +02:00
apex(
2021-01-15 10:53:51 +01:00
data = diamonds,
mapping = aes(x = cut, fill = color)
2019-11-26 14:44:59 +01:00
) \%>\%
2019-06-24 15:18:38 +02:00
ax_chart(stacked = TRUE)
2020-03-03 19:34:07 +01:00
# stack filled
2019-06-24 15:18:38 +02:00
apex(
2021-01-15 10:53:51 +01:00
data = diamonds,
mapping = aes(x = cut, fill = color)
2019-11-26 14:44:59 +01:00
) \%>\%
2019-06-24 15:18:38 +02:00
ax_chart(stacked = TRUE, stackType = "100\%")
2020-03-03 19:34:07 +01:00
# Toolbar --------------------------------------
# Hide the toolbar
2019-06-24 15:18:38 +02:00
apex(
2021-01-15 10:53:51 +01:00
data = diamonds,
mapping = aes(x = cut, fill = color)
2019-11-26 14:44:59 +01:00
) \%>\%
2019-06-24 15:18:38 +02:00
ax_chart(toolbar = list(show = FALSE))
2019-11-26 14:44:59 +01:00
2020-03-03 19:34:07 +01:00
# Hide download buttons
data("economics", package = "ggplot2")
apex(
data = economics,
mapping = aes(x = date, y = pce),
type = "line"
) \%>\%
ax_chart(
toolbar = list(tools= list(download = FALSE))
)
# Zoom -----------------------------------------
# Disable
apex(
data = economics,
mapping = aes(x = date, y = pce),
type = "line"
) \%>\%
ax_chart(
zoom = list(enabled = FALSE)
)
# Auto-scale Y axis
apex(
data = economics,
mapping = aes(x = date, y = pce),
type = "line"
) \%>\%
ax_chart(
zoom = list(autoScaleYaxis = TRUE)
)
# Localization ---------------------------------
2019-11-26 14:44:59 +01:00
# Use included localization config
dat <- data.frame(
x = Sys.Date() + 1:20,
y = sample.int(20, 20)
)
# French
apex(dat, aes(x, y), "line") \%>\%
ax_chart(defaultLocale = "fr")
# Italian
apex(dat, aes(x, y), "line") \%>\%
ax_chart(defaultLocale = "it")
# Custom config
apex(dat, aes(x, y), "line") \%>\%
ax_chart(locales = list(
list(
2020-03-03 19:34:07 +01:00
name = "en", # override 'en' locale
2019-11-26 14:44:59 +01:00
options = list(
toolbar = list(
exportToSVG = "GET SVG",
exportToPNG = "GET PNG"
)
)
)
))
2019-06-24 15:18:38 +02:00
}