Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👑 [需求]v2.x+ Filter类的Interaction默认实现reset button #2828

Open
ace-han opened this issue Jan 6, 2025 · 0 comments
Open

👑 [需求]v2.x+ Filter类的Interaction默认实现reset button #2828

ace-han opened this issue Jan 6, 2025 · 0 comments

Comments

@ace-han
Copy link

ace-han commented Jan 6, 2025

🥰 需求描述 [详细地描述需求,让大家都能理解]

在旧版本上1.x,这个是通过一些配置就能显示这个reset button,并能rollback selection 范围了
代码snippet 如下, 现在要变成自行封装开发了,显得不是很方便

interactions: [
                        {
                          type: "brush-x",
                          cfg: {
                            end: [
                              {
                                trigger: 'plot:mouseup',
                                action: ['x-rect-mask:end', 'x-rect-mask:hide', 'brush-x:filter', 'brush-x:end', 'reset-button:show'],
                              },
                            ],
                            rollback: [
                              {
                                trigger: 'reset-button:click',
                                action: ['brush-x:reset', 'reset-button:hide']
                              }
                            ]
                          }
                        }
                      ],

d73bd0b807ca6859e330b783d41aed69

🧐 解决方案 [如果你有解决方案,在这里清晰地阐述]

通过简单地配置实现,既可以响应事件处理chart.on('brush:filter', (e) => {}), 又可以点击reset button 清除(rollback selection)效果
如图
e8a3d3fcf1abfbe26129762299092910

🚑 其他信息 [如截图等其他信息可以贴在这里]

https://ant-design-charts.antgroup.com/options/plots/interaction/brush-filter
P.S.: 吐槽下,这文档实在是例子很少,Typescript 定义在下钻几层后就直接any了,对这套组件的新手非常不友好, 有待加强
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant