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

e_radar some parameters don't work #98

Closed
hiffman opened this issue Jul 30, 2019 · 4 comments
Closed

e_radar some parameters don't work #98

hiffman opened this issue Jul 30, 2019 · 4 comments

Comments

@hiffman
Copy link

hiffman commented Jul 30, 2019

Hi John,
when I want to change the radar layout, I find (center, radius )parameters don't work. Below is my code.

score_subset = data.frame(
  key = LETTERS[1:5],
  value = c(50,70,80,90,82)
)

e_charts(score_subset, key) %>% 
  e_radar(serie = value, max=100, 
          legend = FALSE, center = c('20%', '45%'),
          radius=100) %>%  
  e_labels(show = TRUE,position = "top") 
  

image

@JohnCoene
Copy link
Owner

I'm afraid radar series do not have center parameter. What are you trying to accomplish?

@hiffman
Copy link
Author

hiffman commented Jul 31, 2019

I want to draw multiple radar, like this. In this example, I find center parameter can adjust position, radius parameter can adjust size.

@JohnCoene
Copy link
Owner

OK. Coming back to this issue. I apologise, I was a bit hasty in saying it's not doable. There is indeed a center parameter but is passed to the radar indicator and not the radar serie.

  1. You can pass that center argument using e_radar_opts. Note that this function is actually already available in the CRAn version but is buggy so resintall from Github with
install.packages("remotes")
remotes::install_github("JohnCoene/echarts4r")
  1. I did try to work on better using the echarts4r grid but it was rather complicated in R and I realised that most of the types of charts (multiple charts that share interactions/legends) can actually be put together ver easily using arrange and connect so I forcused on the latter.

The example below produces pretty much the same output as you want,

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

r1 <- df %>%
  e_charts(x, elementId = "radar1") %>%
  e_radar(y, max = 7) %>%
  e_radar_opts(center = c("50%", "35%"))

r2 <- df %>%
  e_charts(x, elementId = "radar2") %>%
  e_radar(z, max = 7) 

r3 <- df %>%
  e_charts(x, elementId = "radar3") %>%
  e_radar(w, max = 7) %>%
  e_radar_opts(center = c("50%", "35%")) %>%
  e_connect(c("radar1", "radar2", "radar3")) # connect

e_arrange(r1, r2, r3, cols = 3, rows = 1)

I hope this helps.

@hiffman
Copy link
Author

hiffman commented Oct 23, 2019

It's a very good solution . Thank you !

@hiffman hiffman closed this as completed Oct 23, 2019
# 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

2 participants