|
|
|
@ -185,13 +185,13 @@ export class EchartsDataService {
|
|
|
|
|
|
|
|
|
|
// boxWidth > pointX 说明鼠标左边放不下提示框
|
|
|
|
|
if (boxWidth > pointX) { |
|
|
|
|
x = 35; |
|
|
|
|
x = pointX + 60; |
|
|
|
|
} else { // 左边放的下
|
|
|
|
|
x = pointX + 80; |
|
|
|
|
} |
|
|
|
|
// 说明鼠标右边放不下提示框
|
|
|
|
|
if(viewWidth - 100 - pointX < boxWidth){ |
|
|
|
|
x = pointX - boxWidth; |
|
|
|
|
x = pointX - boxWidth-50; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -205,6 +205,136 @@ export class EchartsDataService {
|
|
|
|
|
return [x, y]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//第三层鼠标弹窗效果
|
|
|
|
|
tableTooltipNoShowq(point, params, dom, rect, size) { |
|
|
|
|
// 鼠标坐标和提示框位置的参考坐标系是:以外层div的左上角那一点为原点,x轴向右,y轴向下
|
|
|
|
|
// 提示框位置
|
|
|
|
|
var x = 0; // x坐标位置
|
|
|
|
|
var y = 0; // y坐标位置
|
|
|
|
|
|
|
|
|
|
// 当前鼠标位置
|
|
|
|
|
var pointX = point[0]; |
|
|
|
|
var pointY = point[1]; |
|
|
|
|
|
|
|
|
|
// 外层div大小
|
|
|
|
|
var viewWidth = size.viewSize[0]; |
|
|
|
|
var viewHeight = size.viewSize[1]; |
|
|
|
|
|
|
|
|
|
// 提示框大小
|
|
|
|
|
var boxWidth = size.contentSize[0]; |
|
|
|
|
var boxHeight = size.contentSize[1]; |
|
|
|
|
|
|
|
|
|
// boxWidth > pointX 说明鼠标左边放不下提示框
|
|
|
|
|
if (boxWidth > pointX) { |
|
|
|
|
x = pointX + 40; |
|
|
|
|
//上面放不下
|
|
|
|
|
if (boxHeight > pointY){ |
|
|
|
|
y=pointY+30 |
|
|
|
|
} |
|
|
|
|
//下面放不下
|
|
|
|
|
if(viewHeight+162-pointY<boxHeight){ |
|
|
|
|
y=pointY-boxHeight+90 |
|
|
|
|
}
|
|
|
|
|
} else if(viewWidth - 100 - pointX < boxWidth){ // 左边放的下右边放不下
|
|
|
|
|
x = pointX - boxWidth-50; |
|
|
|
|
//上面放不下
|
|
|
|
|
if (boxHeight > pointY){ |
|
|
|
|
y=pointY+30 |
|
|
|
|
} |
|
|
|
|
//下面放不下
|
|
|
|
|
if(viewHeight+162-pointY<boxHeight){ |
|
|
|
|
y=pointY-boxHeight+90 |
|
|
|
|
}
|
|
|
|
|
//x = pointX + 80;
|
|
|
|
|
}else{//左右都能放下
|
|
|
|
|
//上面放不下
|
|
|
|
|
if (boxHeight > pointY){ |
|
|
|
|
y=pointY+30 |
|
|
|
|
} |
|
|
|
|
//下面放不下
|
|
|
|
|
if(viewHeight+162-pointY<boxHeight){ |
|
|
|
|
y=pointY-boxHeight+90 |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
y=pointY+30 |
|
|
|
|
} |
|
|
|
|
x = pointX + 40;
|
|
|
|
|
} |
|
|
|
|
// 说明鼠标右边放不下提示框
|
|
|
|
|
/* if(viewWidth - 100 - pointX < boxWidth){ |
|
|
|
|
x = pointX - boxWidth-50; |
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// boxHeight > pointY 说明鼠标上边放不下提示框
|
|
|
|
|
/* if (boxHeight > pointY) { |
|
|
|
|
y = 65; |
|
|
|
|
} else { // 上边放得下
|
|
|
|
|
y = pointY - boxHeight; |
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
return [x, y]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//第二层鼠标弹窗效果
|
|
|
|
|
tableTooltipNoShowt(point, params, dom, rect, size) { |
|
|
|
|
// 鼠标坐标和提示框位置的参考坐标系是:以外层div的左上角那一点为原点,x轴向右,y轴向下
|
|
|
|
|
// 提示框位置
|
|
|
|
|
var x = 0; // x坐标位置
|
|
|
|
|
var y = 0; // y坐标位置
|
|
|
|
|
|
|
|
|
|
// 当前鼠标位置
|
|
|
|
|
var pointX = point[0]; |
|
|
|
|
var pointY = point[1]; |
|
|
|
|
|
|
|
|
|
// 外层div大小
|
|
|
|
|
var viewWidth = size.viewSize[0]; |
|
|
|
|
var viewHeight = size.viewSize[1]; |
|
|
|
|
|
|
|
|
|
// 提示框大小
|
|
|
|
|
var boxWidth = size.contentSize[0]; |
|
|
|
|
var boxHeight = size.contentSize[1]; |
|
|
|
|
|
|
|
|
|
// boxWidth > pointX 说明鼠标左边放不下提示框
|
|
|
|
|
if (boxWidth > pointX) { |
|
|
|
|
x = pointX + 40; |
|
|
|
|
//上面放不下
|
|
|
|
|
if (boxHeight > pointY){ |
|
|
|
|
y=pointY+30 |
|
|
|
|
} |
|
|
|
|
//下面放不下
|
|
|
|
|
if(viewHeight+400-pointY<boxHeight){ |
|
|
|
|
y=pointY-boxHeight+105 |
|
|
|
|
}
|
|
|
|
|
} else if(viewWidth - 100 - pointX < boxWidth){ // 左边放的下右边放不下
|
|
|
|
|
x = pointX - boxWidth-50; |
|
|
|
|
//上面放不下
|
|
|
|
|
if (boxHeight > pointY){ |
|
|
|
|
y=pointY+30 |
|
|
|
|
} |
|
|
|
|
//下面放不下
|
|
|
|
|
if(viewHeight+400-pointY<boxHeight){ |
|
|
|
|
y=pointY-boxHeight+90 |
|
|
|
|
}
|
|
|
|
|
//x = pointX + 80;
|
|
|
|
|
}else{//左右都能放下
|
|
|
|
|
//上面放不下
|
|
|
|
|
if (boxHeight > pointY){ |
|
|
|
|
y=pointY+30 |
|
|
|
|
} |
|
|
|
|
//下面放不下
|
|
|
|
|
if(viewHeight+400-pointY<boxHeight){ |
|
|
|
|
y=pointY-boxHeight+90 |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
y=pointY+30 |
|
|
|
|
} |
|
|
|
|
x = pointX + 40;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return [x, y]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//用法:
|
|
|
|
|
// tooltip: {
|
|
|
|
|
// trigger: 'axis',
|
|
|
|
@ -288,6 +418,7 @@ export class EchartsDataService {
|
|
|
|
|
var arrshuzu='['; |
|
|
|
|
for(var i=0;i<yData.length;i++){ |
|
|
|
|
arrshuzu+='{"value":'+yData[i]+',"coord":['+i+','+yData[i]+'],"name":'+'"'+xData[i]+'"'+'},' |
|
|
|
|
//arrshuzu+=`{"value":${yData[i]},"coord":[${i},${yData[i]}],"name":`+`"`+`${xData[i]}`+`"`+`},`
|
|
|
|
|
} |
|
|
|
|
arrshuzu=arrshuzu.substring(0,arrshuzu.length-1) |
|
|
|
|
arrshuzu+=']' |
|
|
|
|