Open
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.
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',
},