Closed sfd99 closed 7 months ago
Hello,
You can use package {htmltools} for that :
library(apexcharter)
library(htmltools)
data("economics", package = "ggplot2")
browsable(tagList(
apex(
data = tail(economics, 150),
mapping = aes(x = date, y = pce),
type = "line",
synchronize = "economics",
height = 350
) %>%
ax_yaxis(
decimalsInFloat = 0,
labels = list(
formatter = format_num("~s"),
minWidth = 40
)
) %>%
ax_tooltip(x = list(format = "yyyy"))
,
apex(
data = tail(economics, 150),
mapping = aes(x = date, y = psavert),
type = "line",
synchronize = "economics",
height = 350
) %>%
ax_yaxis(
decimalsInFloat = 0,
labels = list(
formatter = format_num("~s"),
minWidth = 40
)
) %>%
ax_tooltip(x = list(format = "yyyy"))
))
Note that you have to set an explicit height to each charts.
Victor
Thanks Victor!. Works great.
Q: Any other pages, blog posts or articles with more R code examples of "Sync Charts" using apexcharter ?.
Thanks / Merci!.
sfd99 San Francisco latest R, Rstudio and apexcharter PKG version: 0.4.1
Hi Victor and Fanny!
Thanks f/ the Apexcharter PKG. Really great.
My problem:
When I try the FIRST example to Sync Charts in pg: https://dreamrs.github.io/apexcharter/articles/extra/sync-charts.html#synchronize-charts
I only see the charts as 2 different ( independent ) plots in Rstudio's plot panel. You have to use the Plot Panel <-- arrow keys --> to see each chart...
The tooltips work ok in each of the 2 plots.
But I can not visualize BOTH charts at the same time in the Rstudio Plot panel!. (so that I can actually see the wonderful "sync charts" feature of this EX....).
Help! Au secours!
sfd99 San Francisco latest R, Rstudio and apexcharter PKG version: 0.4.1