[Bug] echarts的tooltip渲染模式为html的时候,在切换页面后,鼠标移动至该echarts偶尔会导致tooltip被带到其他页面,且除刷新页面以外无法消失
Version
5.5.0
Link to Minimal Reproduction
none
Steps to Reproduce
import * as echarts from 'echarts'; import { setTooltipDom } from './index'; export const drawLine = ( dom: HTMLElement, lineData: { [key: number]: number | string; } ) => { let data = []; Object.keys(lineData).forEach((name) => { data.push({ name, value: lineData[name], }); }); dom.style.height = data.length * 210 + 'px'; const chart = echarts.init(dom); let xArr = []; let yArr = []; let gridArr = []; let seriesArr = []; data.forEach((item, index) => { xArr.push({ type: 'category', gridIndex: index, axisTick: false, axisLabel: { color: '#C5D8FF', }, axisLine: { lineStyle: { color: 'rgba(197, 216, 255, 1)', }, }, data: Object.keys(item.value), }); yArr.push({ type: 'value', gridIndex: index, axisLabel: { color: 'rgba(197, 216, 255, 1)', }, splitLine: { lineStyle: { type: 'dashed', color: '#E6F7FF33', }, }, }); gridArr.push({ id: index, height: 150, top: 200 * index + 50, }); seriesArr.push({ type: 'line', name: item.name, data: Object.values(item.value), xAxisIndex: index, yAxisIndex: index, backgroundColor: 'rgb(25, 50, 92)', }); });
let option = {
xAxis: xArr,
yAxis: yArr,
grid: gridArr,
series: seriesArr,
legend: {
show: true,
textStyle: {
color: 'rgba(197, 216, 255, 1)',
},
left: 30,
top: 10,
itemStyle: {},
},
tooltip: {
confine: false,
appendToBody: true,
trigger: 'axis',
axisPointer: {
type: 'line',
axis: 'x',
},
renderMode: 'html',
className: 'geometryTooltip',
padding: 0,
borderWidth: 0,
formatter: (val) => {
return setTooltipDom(val);
},
},
axisPointer: {
link: [
{
xAxisIndex: 'all',
},
],
},
};
chart.setOption(option);
};
Current Behavior
tooltip没有消失
Expected Behavior
希望切换页面后tooltip消失
Environment
- OS:windows11
- Browser: 130.0.6723.117
- Framework:[email protected]
Any additional comments?
No response
@Aweiisdead It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
[Bug] When the tooltip rendering mode of echarts is set to html, moving the mouse to the echarts after switching pages will sometimes cause the tooltip to be taken to other pages, and it will not disappear except for refreshing the page
deal with it manually using the code below?