antvis/G2

[Feat]: elementSelect 支持 region 参数,快捷选择多个元素 #6659

moayuisuda posted onGitHub

Describe the feature / 功能描述

支持 v4 的 active-region 功能 https://stackblitz.com/edit/react-jsce2vmn?file=src%2Findex.js

形似

chart.options({
  interaction: {
    elementSelect: {
      region: true, // 点击空白区域,整个区域都被选中
    },
  },
});

Are you willing to contribute? / 是否愿意参与贡献?

Please select / 请选择


sorry贴错链接了,active-region 是这种 https://stackblitz.com/edit/react-jsce2vmn?file=src%2Findex.js ,v5 的交互一般是针对 element 的,active-region 是 hover 空白时也会高亮对应区域。

posted by moayuisuda about 1 month ago

是要做到hover到空白的plot区域也会高亮吗,我看v4好像也是hover到图形上才行 https://g2-v4.antv.vision/zh/examples/interaction/component#active-region

posted by interstellarmt about 1 month ago

是要做到hover到空白的plot区域也会高亮吗,我看v4好像也是hover到图形上才行 https://g2-v4.antv.vision/zh/examples/interaction/component#active-region

chart.tooltip({
  shared: true,
});

加这个就能 hover 空白了,active-region 当时设计的交互粒度应该就是整个区域 https://github.com/antvis/G2/issues/6582 这个也有提到

posted by moayuisuda about 1 month ago

感觉可以加在elementHlight里面

posted by interstellarmt about 1 month ago

放在 elementXXX 里的话,暂时想的这么配置

elementHight: {
  region: true // 开启后,hover 空白区域,会高亮所有区域内元素。配置了 background: true 的话也会触发区域底色改变
}

elementSelect: {
  region: true // 点击空白区域,整个区域都被选中
}

另外我交互里加了 background 之后,原来的元素级高亮就没了,应该也是个 bug https://g2.antv.antgroup.com/examples/general/interval/#bar-basic-grouped

Image

不加 background Image

posted by moayuisuda about 1 month ago

Fund this Issue

$0.00
Funded

Pull requests