From 1c46695cb8fa428ccfa9e4570e7c395e5eaab573 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Sun, 27 Sep 2020 09:13:34 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=20=E4=BF=AE=E6=94=B9chart=20toolt?= =?UTF-8?q?tip=20=E4=BD=8D=E7=BD=AE=20=E8=B7=9F=E5=B1=8F=E5=B9=95=E4=B8=AD?= =?UTF-8?q?=E7=BA=BF=E6=9C=89=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/charts/line-chart-block.vue | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 053bfff86..359cb6ee8 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -426,6 +426,7 @@ clearData(){ if(getChart(this.chartIndex)){ getChart(this.chartIndex).clear(); + // getChart(this.chartIndex).dispose();//关闭销毁实例 不再占用内存 } }, formatLegend(chartWidth,name){ @@ -557,6 +558,12 @@ /*enterable:true, 导致tooltip不消失,显示多个tooltip*/ position:function(point,params,dom,rect,size){ dom.style.transform = "translateZ(0)"; + var windowWidth=window.innerWidth;//窗口宽度 + var windowHeight=window.innerHeight;//窗口高度 + var windowMouse={ + x:window.event.pageX, + y:window.event.pageY, + } //提示框位置 var x=0; var y=0; @@ -591,15 +598,16 @@ } return [x,y]; }else {//preview page - if(pointX<(viewWidth/2)){//说明鼠标在左边放不下提示框 - x=pointX+10; + + if(windowMouse.x<(windowWidth/2)){//说明鼠标在左边放不下提示框 + x=pointX + 15; }else{ - x = pointX - boxWidth; + x = pointX - boxWidth - 15; } - if(pointY<(viewHeight/2)){//说明鼠标上面放不下提示框 - y = pointY+10; + if(windowMouse.y + 15 +boxHeight