Comments (4)
Thank you very much! I will use that way and close this issue.
from echarts4r.
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:
- For numerical continuous data pass a
vector
- For categorical data pass
TRUE
orFALSE
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.
from echarts4r.
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:
df <- data.frame(
x = 1:10,
y = 1:10
)
df %>%
e_charts(x) %>%
e_line(y) %>%
e_tooltip(
trigger = "item"
)
This doesn't give me a tooltip at x = 10. Do you know what the reason is behind this?
from echarts4r.
Indeed.
Well this is when you could, for instance, use boundaryGap
.
# 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 boundaryGap
- a vector for continuous data, as mentioned above.
p %>% e_x_axis(boundaryGap = c(0, .1))
Or min
and max
p %>% e_x_axis(min = 0, max = 12)
And there are probably other ways I'm unaware of.
from echarts4r.
Related Issues (20)
- timeline with multiple-y-axis setting y axis doesn't work
- timeline with multiple-y-axis setting y axis doesn't work
- e_bar chart combine with e_pie chart HOT 3
- Formatter with ec.clmn HOT 1
- e_river HOT 2
- Race and Waterfalls Charts HOT 6
- 'Cannot find function renderEcharts4r' error in Shiny Quarto document HOT 1
- Problem chaining e_text_g for multiple text placement HOT 2
- Question on shared dataset charts HOT 4
- `e_showtip_p`/ `e_dispatch_action_p` not working in modularized shiny app, attempting to debug with local fork but `debugger` doesn't register in the `addCustomMessageHandler` HOT 2
- How can I change the height and width of the elements (rectangles) on the heat map? HOT 3
- Themes from theme builder needs editing
- Make echarts4r available for webR HOT 1
- [Bug] on example code of Histogram HOT 1
- How to give each grid its own axis maximum? HOT 1
- e_radar not supporting group_by? HOT 1
- Scoring ring HOT 4
- Formatting dataView HOT 2
- margin not working when there are multiple groups of series HOT 10
- leaflet broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from echarts4r.