apache / apache/echarts

[Feature] Disable triggering tooltip for items disabled by visualMap

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

Description

### What problem does this feature solve?

## Version
5.6.0

## Link to minimal reproduction
https://echarts.apache.org/examples/en/editor.html?c=scatter-stream-visual

## Current behaviour
If item is disabled by visualMap, tooltip is still being shown, even if there is no node.

![Image](https://github.com/user-attachments/assets/45f50754-ad24-4b62-b67b-6370df2842fb)

## Steps to reproduce:
Create any chart with visualMap ant tooltip with trigger = 'item', e.g.:
```
visualMap: {
min: 15202,
max: 159980,
dimension: 1,
orient: 'vertical',
right: 10,
top: 'center',
text: ['HIGH', 'LOW'],
calculable: true,
inRange: {
color: ['#f2c31a', '#24b7f2']
}
},
tooltip: {
trigger: 'item',
axisPointer: {
type: 'cross'
}
},
```

## Suggested solution:
Add tooltip.trigger option for active items. e.g. `tooltip.trigger = 'activeItem'`. It will enable to show tooltip only for items that are active (not modified by visualMap) when visualMap is present. At the same time it doesn't modify current logic implemented for `tooltip.trigger = 'item'` which is a default option.

### What does the proposed API look like?

// TooltipModel.ts l.52
/**
* Trigger only works on coordinate system.
*/
trigger?: 'item' | 'activeItem' | 'axis' | 'none'

// use
tooltip: {
trigger: 'activeItem',
},

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.