fixed darkmode, 2nd yaxis example, NEWS
This commit is contained in:
parent
79f04f26da
commit
1a6063e9fb
16
NEWS.md
16
NEWS.md
|
@ -1,3 +1,19 @@
|
||||||
|
apexcharter 0.1.5
|
||||||
|
==================
|
||||||
|
|
||||||
|
## New functions
|
||||||
|
|
||||||
|
* `add_shade()`, `add_shade_weekend()`, `add_event()` to add annotations on timeries charts.
|
||||||
|
* `add_hline()`, `add_vline()`, `add_point()` to add annotations on charts.
|
||||||
|
* `set_tooltip_fixed()` to fix tooltip in specific position.
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
* Dark mode wasn't activated properly in `ax_theme()`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apexcharter 0.1.4
|
apexcharter 0.1.4
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
|
|
@ -1157,19 +1157,7 @@ ax_yaxis <- function(ax,
|
||||||
#' @return A \code{apexcharts} \code{htmlwidget} object.
|
#' @return A \code{apexcharts} \code{htmlwidget} object.
|
||||||
#' @export
|
#' @export
|
||||||
#'
|
#'
|
||||||
#' @examples
|
#' @example examples/ax_yaxis2.R
|
||||||
#'
|
|
||||||
#' library(dplyr)
|
|
||||||
#' data("economics_long", package = "ggplot2")
|
|
||||||
#'
|
|
||||||
#' eco <- economics_long %>%
|
|
||||||
#' filter(variable %in% c("pce", "pop")) %>%
|
|
||||||
#' filter(date >= "2000-01-01")
|
|
||||||
#'
|
|
||||||
#' apex(eco, aes(x = date, y = value, color = variable), type = "line") %>%
|
|
||||||
#' ax_yaxis(title = list(text = "Pce")) %>%
|
|
||||||
#' ax_yaxis2(opposite = TRUE, title = list(text = "Pop"))
|
|
||||||
#'
|
|
||||||
ax_yaxis2 <- function(ax, ...) {
|
ax_yaxis2 <- function(ax, ...) {
|
||||||
params <- dropNulls(list(...))
|
params <- dropNulls(list(...))
|
||||||
yaxis <- .get_ax_opt(ax, "yaxis")
|
yaxis <- .get_ax_opt(ax, "yaxis")
|
||||||
|
@ -1234,6 +1222,6 @@ ax_theme <- function(ax,
|
||||||
mode = mode,
|
mode = mode,
|
||||||
palette = palette,
|
palette = palette,
|
||||||
monochrome = monochrome
|
monochrome = monochrome
|
||||||
), list(...))[-1]
|
), list(...))
|
||||||
.ax_opt2(ax, "theme", l = dropNulls(params))
|
.ax_opt2(ax, "theme", l = dropNulls(params))
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
library(apexcharter)
|
||||||
|
library(dplyr)
|
||||||
|
data("economics_long", package = "ggplot2")
|
||||||
|
|
||||||
|
eco <- economics_long %>%
|
||||||
|
filter(variable %in% c("pce", "pop")) %>%
|
||||||
|
mutate(value = round(value))
|
||||||
|
|
||||||
|
# add second y-axis
|
||||||
|
apex(eco, aes(x = date, y = value, color = variable), type = "line") %>%
|
||||||
|
ax_yaxis(title = list(text = "Pce")) %>%
|
||||||
|
ax_yaxis2(opposite = TRUE, title = list(text = "Pop"))
|
||||||
|
|
||||||
|
# Customize axis a bit more
|
||||||
|
apex(eco, aes(x = date, y = value, color = variable), type = "line") %>%
|
||||||
|
ax_yaxis(
|
||||||
|
title = list(text = "Pce"),
|
||||||
|
axisBorder = list(
|
||||||
|
show = TRUE,
|
||||||
|
color = "#008FFB"
|
||||||
|
),
|
||||||
|
labels = list(
|
||||||
|
style = list(
|
||||||
|
colors = "#008FFB"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
tooltip = list(
|
||||||
|
enabled = TRUE
|
||||||
|
)
|
||||||
|
) %>%
|
||||||
|
ax_yaxis2(
|
||||||
|
opposite = TRUE,
|
||||||
|
min = 160000,
|
||||||
|
forceNiceScale = TRUE,
|
||||||
|
title = list(text = "Pop"),
|
||||||
|
axisBorder = list(
|
||||||
|
show = TRUE,
|
||||||
|
color = "#00E396"
|
||||||
|
),
|
||||||
|
labels = list(
|
||||||
|
style = list(
|
||||||
|
colors = "#00E396"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
tooltip = list(
|
||||||
|
enabled = TRUE
|
||||||
|
)
|
||||||
|
)
|
|
@ -18,16 +18,52 @@ A \code{apexcharts} \code{htmlwidget} object.
|
||||||
Secondary Y-axis options
|
Secondary Y-axis options
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
|
library(apexcharter)
|
||||||
library(dplyr)
|
library(dplyr)
|
||||||
data("economics_long", package = "ggplot2")
|
data("economics_long", package = "ggplot2")
|
||||||
|
|
||||||
eco <- economics_long \%>\%
|
eco <- economics_long \%>\%
|
||||||
filter(variable \%in\% c("pce", "pop")) \%>\%
|
filter(variable \%in\% c("pce", "pop")) \%>\%
|
||||||
filter(date >= "2000-01-01")
|
mutate(value = round(value))
|
||||||
|
|
||||||
|
# add second y-axis
|
||||||
apex(eco, aes(x = date, y = value, color = variable), type = "line") \%>\%
|
apex(eco, aes(x = date, y = value, color = variable), type = "line") \%>\%
|
||||||
ax_yaxis(title = list(text = "Pce")) \%>\%
|
ax_yaxis(title = list(text = "Pce")) \%>\%
|
||||||
ax_yaxis2(opposite = TRUE, title = list(text = "Pop"))
|
ax_yaxis2(opposite = TRUE, title = list(text = "Pop"))
|
||||||
|
|
||||||
|
# Customize axis a bit more
|
||||||
|
apex(eco, aes(x = date, y = value, color = variable), type = "line") \%>\%
|
||||||
|
ax_yaxis(
|
||||||
|
title = list(text = "Pce"),
|
||||||
|
axisBorder = list(
|
||||||
|
show = TRUE,
|
||||||
|
color = "#008FFB"
|
||||||
|
),
|
||||||
|
labels = list(
|
||||||
|
style = list(
|
||||||
|
colors = "#008FFB"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
tooltip = list(
|
||||||
|
enabled = TRUE
|
||||||
|
)
|
||||||
|
) \%>\%
|
||||||
|
ax_yaxis2(
|
||||||
|
opposite = TRUE,
|
||||||
|
min = 160000,
|
||||||
|
forceNiceScale = TRUE,
|
||||||
|
title = list(text = "Pop"),
|
||||||
|
axisBorder = list(
|
||||||
|
show = TRUE,
|
||||||
|
color = "#00E396"
|
||||||
|
),
|
||||||
|
labels = list(
|
||||||
|
style = list(
|
||||||
|
colors = "#00E396"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
tooltip = list(
|
||||||
|
enabled = TRUE
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,5 +38,4 @@ apex(
|
||||||
type = "line"
|
type = "line"
|
||||||
) \%>\%
|
) \%>\%
|
||||||
set_tooltip_fixed()
|
set_tooltip_fixed()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue