echarts4r:像 d3heatmap 一样缩放

echarts4r: zoom like in d3heatmap

echarts4r有没有类似d3heatmap的缩放热图的方法? (https://github.com/rstudio/d3heatmap)。目的是使用 echarts4r 中的回调在 d3heatmap 没有(据我所知)的热图上单击并悬停时触发事件。

此代码是从(https://echarts4r.john-coene.com/articles/chart_types.html#heatmap)复制的,添加了画笔。画笔显示并可以 select 缩放 window,但图表不会缩放。

v <- LETTERS[1:10]
matrix <- data.frame(
  x = sample(v, 300, replace = TRUE), 
  y = sample(v, 300, replace = TRUE), 
  z = rnorm(300, 10, 1),
  stringsAsFactors = FALSE
) %>% 
  dplyr::group_by(x, y) %>% 
  dplyr::summarise(z = sum(z)) %>% 
  dplyr::ungroup()

matrix %>% 
  e_charts(x) %>% 
  e_heatmap(y, z) %>% 
  e_visual_map(z) %>% 
  e_title("Heatmap") %>%
  e_brush() # add the brush

画笔和缩放在echarts中是两个不同的东西:用e_datazoom代替。

v <- LETTERS[1:10]
matrix <- data.frame(
  x = sample(v, 300, replace = TRUE), 
  y = sample(v, 300, replace = TRUE), 
  z = rnorm(300, 10, 1),
  stringsAsFactors = FALSE
) %>% 
  dplyr::group_by(x, y) %>% 
  dplyr::summarise(z = sum(z)) %>% 
  dplyr::ungroup()

matrix %>% 
  e_charts(x) %>% 
  e_heatmap(y, z) %>% 
  e_visual_map(z) %>% 
  e_title("Heatmap") %>%
  e_datazoom() # use zoom