Echarts如果data较多tooltip默认显示会遗漏一些数据,导致无法展示

ECharts tooltip 位置设置_ecmascript

解决方法:
tooltip增加position函数,自动更新位置

tooltip: {
trigger: 'axis',
position(
point: number[],
_params: unknown,
_dom: unknown,
_rect: unknown,
size: { contentSize: number[] }
) {
const [pointX, pointY] = point;
const [boxWidth, boxHeight] = size.contentSize;
const x = boxWidth > pointX ? pointX + 10 : pointX - boxWidth - 10;
const y = boxHeight > pointY ? 5 : pointY - boxHeight;
return [x, y];
},
},

ECharts tooltip 位置设置_echarts_02