tooltip: { trigger: "axis", position: function (point, params, dom, rect, size) { var x = 0; // x坐标位置 var y = 0; // y坐标位置 // 当前鼠标位置 var pointX = point[0]; var pointY = point[1]; // 提示框大小 var boxWidth = size.contentSize[0]; var boxHeight = size.contentSize[1]; // boxWidth > pointX 说明鼠标左边放不下提示框 if (boxWidth > pointX) { x = pointX + 10; } else { // 左边放的下 x = pointX - boxWidth + 100; } // boxHeight > pointY 说明鼠标上边放不下提示框 if (boxHeight > pointY) { y = 5; } else { // 上边放得下 y = pointY - boxHeight; } return [x, y]; }, },
标签:boxHeight,point,boxWidth,tooltip,pointX,var,pointY,echarts,调试 From: https://www.cnblogs.com/yjd-05/p/17665224.html