-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BoundaryGap #14
Comments
I cannot reproduce the issue. Say we plot something clearer first. df <- data.frame(
x = 1:10,
y = 1:10
)
df %>%
e_charts(x) %>%
e_line(y) %>%
e_tooltip(
trigger = "axis"
) You shouldn't see any boundary gap. Now say we plot your example again, but with tighter boundaries to our graph. min <- min(mtcars$wt)
max <- max(mtcars$wt)
mtcars %>%
e_charts(wt) %>%
e_area(qsec) %>%
e_x_axis(
min = min,
max = max
) %>%
e_tooltip(trigger = "axis") The documentation for boundaryGap actually states that the parameter works differently for numerical and categorical data:
mtcars %>%
e_charts(wt) %>%
e_area(qsec) %>%
e_x_axis(
boundaryGap = c("50%", "50%") # add boundary gap
) %>%
e_tooltip(trigger = "axis") If you have categorical: df <- data.frame(
x = LETTERS[1:4],
y = runif(4, 1, 3)
)
df %>%
e_chart(x) %>%
e_bar(y) %>%
e_x_axis(
boundaryGap = FALSE
) So generally speaking you want to use boundaryGap depending on the data you have and the plot you are trying to create. Let me know if this helps. |
Thank you very much for your quick reply! All seems to work very well and I can use the tool_tip as well when using "axis". However, if I change the e_tooltip to "item" instead of "axis", I do not get the tooltip for the maximum x-value. So for your first example:
This doesn't give me a tooltip at x = 10. Do you know what the reason is behind this? |
Indeed. Well this is when you could, for instance, use # initialise chart
df <- data.frame(
x = 1:10,
y = 1:10
)
df %>%
e_charts(x) %>%
e_line(y) %>%
e_tooltip(
trigger = "item"
) %>%
e_tooltip(trigger = "item") -> p Using p %>% e_x_axis(boundaryGap = c(0, .1)) Or p %>% e_x_axis(min = 0, max = 12) And there are probably other ways I'm unaware of. |
Thank you very much! I will use that way and close this issue. |
First of all, many thanks for this amazing package!
When creating a line chart, I came across the fact that there is always a gap between the start/end of the line-chart and the x-axis. I found out through Baidu that you can change this by setting boundaryGap to FALSE.
However, I could not get this to work. I tried the following:
mtcars %>% e_charts(wt) %>% e_area(qsec) %>% e_x_axis(boundaryGap = FALSE, min = 1)
Is this not available in the package or did I do something wrong? Thank you!
The text was updated successfully, but these errors were encountered: