Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

legend 不显示,不能触发 legendFilter 事件 #5943

Closed
YY88Xu opened this issue Dec 16, 2023 · 1 comment
Closed

legend 不显示,不能触发 legendFilter 事件 #5943

YY88Xu opened this issue Dec 16, 2023 · 1 comment

Comments

@YY88Xu
Copy link

YY88Xu commented Dec 16, 2023

问题描述

`import { Chart } from '@antv/g2';

const chart = new Chart({ container: 'container' });

chart
.interval()
.data([
{ genre: 'Sports', sold: 0 },
{ genre: 'Strategy', sold: 115 },
{ genre: 'Action', sold: 120 },
{ genre: 'Shooter', sold: 350 },
{ genre: 'Other', sold: 150 },
])
.encode('x', 'genre')
.encode('y', 'sold')
.encode('color', 'genre')
.style('minHeight', 50)
.legend(false)

chart.render()

setTimeout(()=>{
console.log('test')
chart.emit('legend:filter', {
data: { channel: 'color', values: ['Sports', 'Strategy'] },
});
}, 2000)
`

重现链接

No response

重现步骤

chart
.legend(false)
希望也外部控制 legend:filter 事件触发

预期行为

No response

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@pearmini
Copy link
Member

不没有 legend 不会去监听 legend:filter 事件,可以通过 chart.changeData 替代。

@antvis antvis locked and limited conversation to collaborators Dec 18, 2023
@pearmini pearmini converted this issue into discussion #5950 Dec 18, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants