Closed oude-gao closed 3 years ago
Hello, Thanks for reporting that, yes I think there's room for improvement here. I'll take a look. Have you some examples with bad x-axis ?
Victor
Ok, if you re-install from GitHub, those examples should display dates formatted properly on x-axis :
library(apexcharter)
dat1 <- data.frame(
date = Sys.Date() + 1:20,
var1 = round(rnorm(20, 50, 10))
)
apex(dat1, aes(date, var1), "column")
dat2 <- data.frame(
date = Sys.Date() + rep(1:10, 2),
var1 = round(rnorm(20, 50, 10)),
group = rep(c("a", "b"), each = 10)
)
apex(dat2, aes(date, var1, group = group), "column")
dat3 <- data.frame(
date = sample(Sys.Date() + 1:20, 100, TRUE),
var1 = round(rnorm(100, 50, 10))
)
apex(dat3, aes(date, var1), "scatter")
This works like a charm! There is one little minor issue --
So I get this very wide selection shade when I just highlight one bar over there, do you think it's caused by the stacked bar there? Because I didn't see the behavior in your example above.
Thanks!!
Arf, I activate shared tooltip option by default (to show all value in a single tooltip), this is what is causing this bug, I'll search if it's a JS or R error. meantime two workaround are possible :
dat2 <- data.frame(
date = Sys.Date() + rep(1:10, 2),
var1 = round(rnorm(20, 50, 10)),
group = rep(c("a", "b"), each = 10)
)
# disable shared tooltip
apex(dat2, aes(date, var1, group = group), "column") %>%
ax_chart(stacked = TRUE) %>%
ax_tooltip(shared = FALSE)
# hide overlay
apex(dat2, aes(date, var1, group = group), "column") %>%
ax_chart(stacked = TRUE) %>%
ax_xaxis(
crosshairs = list(show = FALSE)
)
I'm thinking using the second by default in the package, what do you think ?
Yes I think the second option does make more sense. I don't know why, but there seems to be a glitch (that two layers of the tooltip):
But it's interesting how the plot is reacting to all those solutions! Thanks a lot for your help!
Hi, big fan of the package, encountered one issue so far -- whenever the x axis is date, there are problems. For scatter/line plot, the date will show up, but it's not lining up with the ticks, so I need to adjust the timezone (for my case it's from EST to GMT); and for barcharts, date can't simply be displayed, instead it's the numeric value of timestamp. I wonder if you had similar issues before, would really appreciate it if this could be addressed to some extent!