Forráskód Böngészése

滚动相关性画图逻辑更改

Karsa 1 éve
szülő
commit
c1c48fb5ae
1 módosított fájl, 22 hozzáadás és 10 törlés
  1. 22 10
      src/views/hzyb/chart/Detail.vue

+ 22 - 10
src/views/hzyb/chart/Detail.vue

@@ -393,10 +393,10 @@ const getRelevanceDetail=async ()=>{
     if(res.code===200){
         resData.value=res.data
         
-        if([3,4].includes(res.data.ChartInfo.Source)) { //相关性
+        if([3].includes(res.data.ChartInfo.Source)) { //相关性
             relevanceChartData.value=res.data
             initRelevanceChart(res.data);
-        }else if([6,7,8].includes(res.data.ChartInfo.Source)) { //拟合方程曲线 标准差 百分比
+        }else if([4,6,7,8].includes(res.data.ChartInfo.Source)) { //滚动相关性 拟合方程曲线 标准差 百分比
             setSplineOpt([res.data.DataResp])
         }else if(res.data.ChartInfo.Source===9) { //统计频率
             statisticFrequencyData.value = res.data.DataResp;
@@ -463,11 +463,11 @@ const initRelevanceChart=(data)=>{
           },
           align: 'center',
         },
-        min: -1,
-        max: 1,
+        // min: -1,
+        // max: 1,
         opposite: false,
         tickWidth: 1,
-        tickInterval:0.2,
+        // tickInterval:0.2,
     }
 
     //处理series
@@ -500,11 +500,11 @@ const initRelevanceChart=(data)=>{
     }
     
     nextTick(()=>{
-        if(data.ChartInfo.Source===3) {
-            const hEl=document.getElementById('chart-box')
-            console.log(hEl.offsetHeight);
-            xAxis.offset=-(hEl.offsetHeight-74)/2
-        }
+        // if(data.ChartInfo.Source===3) {
+        //     const hEl=document.getElementById('chart-box')
+        //     console.log(hEl.offsetHeight);
+        //     xAxis.offset=-(hEl.offsetHeight-74)/2
+        // }
         chartData.value = {
             isRelevanceChart:data.ChartInfo.Source===3,
             title: {
@@ -1199,6 +1199,18 @@ const setSplineOpt=(data)=>{
     chartData.value.yAxis=yAxis
     chartData.value.rangeSelector={ enabled: false}
 
+     //滚动相关性独立tooltip
+    if(resData.value.ChartInfo.Source === 4) {
+        const { LeadValue,LeadUnit } = resData.value.CorrelationChartInfo;
+        chartData.value.tooltip = {
+          formatter: function() {
+            let str = `${Highcharts.dateFormat('%Y/%m/%d',this.x)}<br><p>相关性系数:${this.y.toFixed(4)}</p><br><p>领先${LeadValue+LeadUnit}</p>`
+           
+            return str
+          }
+        }
+    }
+
 }
 
 /* 堆叠图/组合图设置