Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Clicking on radar legend does not toggle the right series #74

Closed
antoine-sachet opened this issue May 1, 2019 · 4 comments
Closed

Clicking on radar legend does not toggle the right series #74

antoine-sachet opened this issue May 1, 2019 · 4 comments

Comments

@antoine-sachet
Copy link

This is apparent on the radar demo.

Code to reproduce:

df <- data.frame(
    x = LETTERS[1:5],
    y = runif(5, 1, 5),
    z = runif(5, 3, 7)
)

df %>% 
    e_charts(x) %>% 
    e_radar(y, max = 7, name = "radar") %>%
    e_radar(z, max = 7, name = "chart") %>%
    e_tooltip(trigger = "item")

Clicking on the first element of the legend, "radar", removes both the "radar" and "chart" series. It should only remove the first series.

@etiennebacher
Copy link
Contributor

I am having the same bug, do you know how to fix it @JohnCoene?

@etiennebacher
Copy link
Contributor

etiennebacher commented Aug 19, 2020

This bug only appears in radar plots (to my knowledge). For example, there are no problems with line plots:

library(echarts4r)

df <- data.frame(
  x = LETTERS[1:5],
  y = runif(5, 1, 5),
  z = runif(5, 3, 7)
)

# legend doesn't work with radar
df %>% 
  e_charts(x) %>% 
  e_radar(y, max = 7, name = "radar") %>%
  e_radar(z, max = 7, name = "chart")

# legend works with lines
df %>%
  e_charts(x) %>%
  e_line(y) %>%
  e_line(z)

I checked the preview in echarts.js documentation and the legend works well so I guess this bug comes from the R package. I tried to compare the code of e_radar_ to the code of e_line_ but I didn't find anything unusual (though I'm far from being an expert in R, and even less in JS). Any idea where this comes from?

@JohnCoene
Copy link
Owner

Sorry, I had overlooked this issue, I pushed a fix to Github main branch just now.

@daljio56
Copy link

daljio56 commented Dec 3, 2020

one option is try to indicate that the first legend control the whole radar chart, and then add radar for each element, with that at lease each element has its buttom to be hide and show.

It's a trick to try to overcome the problem, it not solve the real issue.

df <- data.frame(
x = LETTERS[1:5],
y = runif(5, 1, 5),
z = runif(5, 3, 7)
)

df$w <- NA

df %>%
e_charts(x) %>%
e_radar(w, max = 7, name = "radar") %>%
e_radar(y, max = 7, name = "var1") %>%
e_radar(z, max = 7, name = "var2") %>%
e_tooltip(trigger = "item")

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants