rui.jiang vor 4 Monaten
Ursprung
Commit
b56d52b897

+ 12 - 7
src/views/performance/components/custonAsCom/dragChart/components/chartConfig/form/chartLogic/modules/Heatmap.js

@@ -102,16 +102,22 @@ export function handleHeatmapPlotChartLogic(
     const heatmapData = [];
 
     for (let i = 0; i < yAxisData.length; i++) {
-      for (let j = 0; j < xAxisData.length; j++) {
+      for (let j = 0; j < item.Ydata.length; j++) {
+        console.log("i j", xAxisData, yAxisData, item.Ydata[j].label);
         // 对应 Ydata 中每个风机的数据,i 对应时间索引
-        const valueStr = item.Ydata[j]?.data[i]?.[item.Ydata[j].label];
-        const value =
-          valueStr !== undefined && valueStr !== "" ? Number(valueStr) : 0;
-        heatmapData.push([i, j, value]); // [yIndex, xIndex, value]
+        const xInd = xAxisData.findIndex(
+          (xval) => xval === item.Ydata[j].label
+        );
+        console.log(xInd, "xInd");
+        if (xInd !== -1) {
+          let indexVal = item.Ydata[j]?.data[i]?.[item.Ydata[j].label];
+          const value =
+            indexVal !== undefined && indexVal !== "" ? Number(indexVal) : 0;
+          heatmapData.push([xInd, i, value]); // [yIndex, xIndex, value]
+        }
       }
     }
 
-
     // 生成热力图数据
     item.option.series = [
       {
@@ -134,6 +140,5 @@ export function handleHeatmapPlotChartLogic(
         },
       },
     ];
-
   }
 }

+ 1 - 2
src/views/performance/components/custonAsCom/dragChart/components/chartConfig/form/chartTitle.vue

@@ -158,8 +158,7 @@
                   // curEdit.type !== 'roseChart' &&
                   curEdit.type !== 'pie' &&
                   curEdit.type !== 'doughnut' &&
-                  curEdit.type !== 'sankeyDiagram' &&
-                  curEdit.type !== 'Heatmap'
+                  curEdit.type !== 'sankeyDiagram'
                 "
                 :content="
                   formLabelAlign.Ydata.length <= 1