user3355655
user3355655

Reputation: 485

echarts4r multiple axis on different grids

I would like to get a chart with 2 grids. One with two y axis. a and b on one graph with 2 y axis and c,d,and e on another grid. I tried to number them from 0,1 and 2, but it doesn't work. I would need to add an Y axis as on the picture below enter image description here Thanks

 df <- data.frame(
  x = 1:20, 
  a = runif(20, 10, 100),
  b = runif(20, 10, 1000),
  c= runif(20, 10, 300),
  d = runif(20, 10, 300),
  e= runif(20, 10, 300)
)


df |> 
  e_charts(x) |> 
  e_line(a,x_index = 0, y_index = 0) |>
  e_line(b,x_index = 0, y_index = 0) |>
  e_bar(c, stack = "grp",x_index = 1, y_index = 1) |>
  e_bar(d, stack = "grp",x_index = 1, y_index = 1) |>
  e_bar(e, stack = "grp",x_index = 1, y_index = 1) |>
  # e_bar(H1N1pdm, stack = "grp",x_index = 1, y_index = 1) |>
  # e_bar(Flu_B_Victoria, stack = "grp",x_index = 1, y_index = 1) |>
  # e_bar(H1N1pdm_Flu_B, stack = "grp",x_index = 1, y_index = 1) |>
  e_grid(height = "25%") |> 
  e_grid(height = "25%", top = "50%") |>
  e_y_axis(gridIndex = 1) |>
  e_x_axis(gridIndex = 1) |>
  e_tooltip(trigger = "axis") |>
  e_datazoom(x_index = c(0, 1))

Upvotes: 1

Views: 332

Answers (0)

Related Questions