Skip to content
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

e_radar some parameters don't work #98

Open
hiffman opened this issue Jul 30, 2019 · 3 comments

Comments

@hiffman
Copy link

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

This comment has been minimized.

Copy link
Owner

commented Jul 30, 2019

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

@hiffman

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Owner

commented Aug 27, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.