Reputation: 31
The docs say that if tooltip.trigger: 'none' that the tooltip can be displayed by calling dispatchAction with type 'showTip'. But I cannot seem to get that to work. Does anyone have a snippet of working code that uses the showTip action and can show how their tooltip is configured to make this work?
I have tried with both {show: false, trigger: 'axis'} and with {show: true, trigger 'none'}. In both cases, the showTip action does nothing.
The reason I can't just use the default axis trigger {show: true, trigger: 'axis'} is because it breaks series highlighting (a bug, I assume). So I'm trying to find a way to display the tooltip anywhere the mouse goes on the chart, but without disabling highlighting.
**UPDATE: I finally gave up on EChart tooltips and ended up just creating my own. Positioning information can be obtained using the ZRender component in this way:
chartObj.getZr().on('mousemove', e => {
// mouse position within chart, in pixels
const pointInPixel = [e.offsetX,e.offsetY]
})
Upvotes: 0
Views: 1480
Reputation: 4430
You have chosen the most difficult way. To show/hide tooltip you need update state of Instance:
instance.setOption({ tooltip: {show: true }}) // or show: false
Upvotes: 0