apache / apache/echarts

[Bug] Echartinstance.on event - eventQuery

Open
#21,584 3 comments 0 reactions 0 assignees View on GitHub
bug pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

6.0.0

### Link to Minimal Reproduction

https://codesandbox.io/p/sandbox/vmsnfc?file=%2Findex.js

### Steps to Reproduce

```js
option = {
title: {
text: 'Stacked Line'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['Email', 'Union Ads']
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
id: '1',
name: 'Email',
type: 'line',
stack: 'Total',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
id: '2',
name: 'Union Ads',
type: 'line',
stack: 'Total',
data: [220, 182, 191, 234, 290, 330, 310]
}
]
};

myChart.on('click', { seriesId: '1' }, function (params) {
console.log('====123');
console.log('=====',params);

myChart.setOption({
series: [
{
id: '1',
data: [10, 20, 30, 40, 50, 60, 70]
}
]
});
});
myChart.on('click', { seriesId: '2' }, function (params) {
console.log('====1244443');
console.log('=====',params);

myChart.setOption({
series: [
{
id: '2',
data: [10, 20, 30, 40, 50, 60, 70]
}
]
});
});
```

### Current Behavior

When trigger event on series with id = '1' both events triggered
When trigger event on series with id = '2' only event with eventQuery = { seriesId: '2' } triggered

### Expected Behavior

events should be filtered correctly by seriesId

### Environment

```markdown
- OS:
- Browser:
- Framework:
```

### Any additional comments?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.