Skip to content

[Feature] Disable triggering tooltip for items disabled by visualMap #21053

Open
@JuliaCwynar

Description

@JuliaCwynar

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enThis issue is in Englishnew-featurependingWe are not sure about whether this is a bug/new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions