antvis/G2

chart设置filterData不生效 #3727

xiangchunyu posted onGitHub

  • I have searched the issues of this repository and believe that this is not a duplicate.

Edit on CodeSandbox

Steps to reproduce

点击interval使用filterData过滤新数据,预期展示新的过滤数据,但未达到预期

Environment Info
g2 4.1.34
System -
Browser -

使用filter可以正常过滤

<!-- generated by antv-issue-helper. DO NOT REMOVE -->


没有 filterData 这个 api 把~

posted by hustcc over 3 years ago

文档上是有这个api的呀 https://g2-v4.antv.vision/zh/docs/api/general/chart#viewfilterdata 麻烦再看一下?是用法不对么

posted by xiangchunyu over 3 years ago

试了一下没有的api是直接会报错的,但是使用filterData没有报错,只是不生效

posted by xiangchunyu over 3 years ago

这个算是一个内部方法吧,你直接使用 filter 方法吧~

posted by hustcc over 3 years ago

额 但是filter对我的场景不适用,我这边还是需要使用filterData,可以把filterData暴露一下么像filter一样

posted by xiangchunyu over 3 years ago

可以描述下你的场景嘛?我帮你看看怎么做比较合适~

posted by hustcc over 3 years ago

想默认展示数据里面的某一批数据,这批数据是直接给好的,用filter不好设置过滤规则,但是用filterData就可以直接设置这批数据了

posted by xiangchunyu over 3 years ago

那就用 changeData 这个 API 了。直接改变数据就可以了。

posted by hustcc over 3 years ago

试过changeData这个api 这个应该是重置整个data了 但想要的效果不是这样的 changeData改变数据源后没有展示出来的数据的图例也都没了 但是是想没有展示出来的图例是置灰的这种

posted by xiangchunyu over 3 years ago

要不贴一下 filter 前和后的数据。不知道为啥 filter api 没法满足?

posted by hustcc over 3 years ago

嗯嗯 这边要是不会开放filterData api的话 我这边再看下吧 使用filter也可以 不过你们文档如果不支持这个api感觉可以下掉 看文档比较有误导性 谢谢~

posted by xiangchunyu over 3 years ago

文档已移除!

posted by hustcc over 2 years ago

Fund this Issue

$0.00
Funded

Pull requests