简体   繁体   English

echarts4r:像 d3heatmap 一样放大

[英]echarts4r: zoom like in d3heatmap

Is there a way to zoom heatmaps in echarts4r similar to d3heatmap? echarts4r 有没有办法像 d3heatmap 一样缩放热图? ( https://github.com/rstudio/d3heatmap ). https://github.com/rstudio/d3heatmap )。 The purpose is to use the callbacks in echarts4r to trigger events when clicking and hovering over on the heatmap which d3heatmap doesn't have (that I know of).目的是使用 echarts4r 中的回调在单击并悬停在 d3heatmap 没有(我知道)的热图上时触发事件。

This code is copied from ( https://echarts4r.john-coene.com/articles/chart_types.html#heatmap ) with the addition of the brush.此代码是从 ( https://echarts4r.john-coene.com/articles/chart_types.html#heatmap ) 复制的,并添加了画笔。 The brush shows and can select a zoom window, however the chart doesn't zoom.画笔显示并可以选择缩放窗口,但图表不会缩放。

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

The brush and the zoom are two different things in echarts: use e_datazoom instead.笔刷和缩放在 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM