2019-11-26 14:44:59 +01:00
|
|
|
library(dplyr)
|
|
|
|
data("diamonds", package = "ggplot2")
|
|
|
|
|
2020-03-03 19:34:07 +01:00
|
|
|
## Stack bar type
|
|
|
|
# default is dodge
|
|
|
|
apex(
|
|
|
|
data = count(diamonds, cut, color),
|
|
|
|
mapping = aes(x = cut, y = n, fill = color)
|
|
|
|
)
|
|
|
|
|
|
|
|
# stack
|
2019-11-26 14:44:59 +01:00
|
|
|
apex(
|
|
|
|
data = count(diamonds, cut, color),
|
|
|
|
mapping = aes(x = cut, y = n, fill = color)
|
|
|
|
) %>%
|
|
|
|
ax_chart(stacked = TRUE)
|
|
|
|
|
2020-03-03 19:34:07 +01:00
|
|
|
# stack filled
|
2019-11-26 14:44:59 +01:00
|
|
|
apex(
|
|
|
|
data = count(diamonds, cut, color),
|
|
|
|
mapping = aes(x = cut, y = n, fill = color)
|
|
|
|
) %>%
|
|
|
|
ax_chart(stacked = TRUE, stackType = "100%")
|
|
|
|
|
|
|
|
|
2020-03-03 19:34:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Toolbar --------------------------------------
|
|
|
|
|
|
|
|
# Hide the toolbar
|
2019-11-26 14:44:59 +01:00
|
|
|
apex(
|
|
|
|
data = count(diamonds, cut, color),
|
|
|
|
mapping = aes(x = cut, y = n, fill = color)
|
|
|
|
) %>%
|
|
|
|
ax_chart(toolbar = list(show = FALSE))
|
|
|
|
|
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)
|
|
|
|
)
|