-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Problem chaining e_text_g for multiple text placement #610
Comments
I posted the problem also on stack overflow. |
Well, I digged into the code and I think echarts4r doesn't seem to cause this unexpected behaviour. I am starting to think echarts itself doesn't allow for more than one graphical element per chart. @munoztd0, what do you think? |
It's definitely possible to add multiple graphic elements with echarts. So I think this is a bug in Here is a working example using df <- data.frame(
x = seq(10),
y = rnorm(10, 10, 3)
)
# Define graphic elements as a list of arguments
graphic_elements <- list(
graphic = list(
list(
type = "text",
left = "10%",
top = "7%",
style = list(
text = "left",
fontSize = 30,
fill = "red"
)
),
list(
type = "text",
right = "10%",
top = "7%",
style = list(
text = "right",
fontSize = 30,
fill = "red"
)
)
),
xAxis = list(
type = "value",
data = list(value = df$x)
),
yAxis = list(
type = "value"
),
series = list(
list(
type = "scatter",
data = as.list(unname(as.data.frame(t(df))))
)
)
)
# Add graphic elements to the chart using e_list()
echarts4r::e_chart() |>
echarts4r::e_list(graphic_elements)
|
Gonna take a look thanks |
I encountered an issue when attempting to use
e_text_g()
to place text on both the left and right sides of a plot. While individually placing text on either side works well, attempting to combine both commands results in failure.Created on 2024-01-03 with reprex v2.0.2
Session info
Placing text on the left side works as expected:
And on the right side:
However, when attempting to place text on both sides by chaining both commands, an issue arises:
Expected Behavior
I would expect to successfully place text on both the left and right sides of the plot by chaining the
e_text_g
commands.Thank you for looking into this issue. Any alternative approaches or suggestions for achieving the placement of text on both sides of the plot with reproducible distances from the borders are greatly appreciated.
The text was updated successfully, but these errors were encountered: