Jelajahi Sumber

修改数据颜色无法回显bug

liujiejie 2 bulan lalu
induk
melakukan
83d36bb679

+ 162 - 120
demo.html

@@ -16,136 +16,178 @@
   <body>
     <div id="plot"></div>
     <script>
-      const xLabels = ["A", "B", "C"];
-      const yLabels = ["Monday", "Tuesday", "Wednesday"];
-      const dataMatrix = [
-        [5, 8, 6],
-        [4, 2, 9],
-        [7, 3, 5],
-      ];
+      //反转字符串
+      // let str = "1234567";
+      // 方法1:
+      // str.split("").reverse().join("");
+      // 方法2:
+      // const brr = str.split("").reduce((rev, ch) => {
+      //   return ch + rev;
+      // }, "");
+      // console.log(brr, "brr");
+      // //递归
+      // function recursionFn(n) {
+      //   if (n === 0) return 0; // 递归终止条件
+      //   return n + recursionFn(n - 1);
+      // }
+      // console.log(recursionFn(10));
 
-      // 构造立方体柱子
-      const traces = [];
-      const barWidth = 0.8;
+      //js map 方法
+      // if (!Array.prototype.myMap) {
+      //   Array.prototype.myMap = function (callback, thisArg) {
+      //     if (typeof callback !== "function") {
+      //       console.error("callback 必须是一个函数");
+      //     }
+      //     console.log(this, thisArg);
+      //     const arr = this;
+      //     const result = new Array(arr.length);
+      //     for (let i = 0; i < arr.length; i++) {
+      //       if (!(i in arr)) continue;
+      //       result[i] = callback.call(thisArg, arr[i], i, arr);
+      //     }
+      //     return result;
+      //   };
+      // }
+      // const numArray = [1, 4, null, 7, 3];
+      // const numResult = numArray.myMap(
+      //   function (val, index) {
+      //     console.log("myMap 回调函数", this.obj, val, index);
+      //     return this.obj + val;
+      //   },
+      //   { obj: "这个是this" }
+      // );
+      // console.log(numResult, "numResult");
 
-      for (let xi = 0; xi < xLabels.length; xi++) {
-        for (let yi = 0; yi < yLabels.length; yi++) {
-          const height = dataMatrix[yi][xi];
+      // const xLabels = ["A", "B", "C"];
+      // const yLabels = ["Monday", "Tuesday", "Wednesday"];
+      // const dataMatrix = [
+      //   [5, 8, 6],
+      //   [4, 2, 9],
+      //   [7, 3, 5],
+      // ];
 
-          const x = xi;
-          const y = yi;
-          const z = 0;
+      // // 构造立方体柱子
+      // const traces = [];
+      // const barWidth = 0.8;
 
-          // 立方体8个顶点
-          const vertices = [
-            [x, y, z],
-            [x + barWidth, y, z],
-            [x + barWidth, y + barWidth, z],
-            [x, y + barWidth, z],
-            [x, y, z + height],
-            [x + barWidth, y, z + height],
-            [x + barWidth, y + barWidth, z + height],
-            [x, y + barWidth, z + height],
-          ];
+      // for (let xi = 0; xi < xLabels.length; xi++) {
+      //   for (let yi = 0; yi < yLabels.length; yi++) {
+      //     const height = dataMatrix[yi][xi];
 
-          // 每个立方体的面(两个三角形组成一个面)
-          const faces = [
-            [0, 1, 2],
-            [0, 2, 3], // bottom
-            [4, 5, 6],
-            [4, 6, 7], // top
-            [0, 1, 5],
-            [0, 5, 4], // front
-            [1, 2, 6],
-            [1, 6, 5], // right
-            [2, 3, 7],
-            [2, 7, 6], // back
-            [3, 0, 4],
-            [3, 4, 7], // left
-          ];
+      //     const x = xi;
+      //     const y = yi;
+      //     const z = 0;
 
-          // 拆解为 Plotly mesh3d 的输入格式
-          const xVals = vertices.map((v) => v[0]);
-          const yVals = vertices.map((v) => v[1]);
-          const zVals = vertices.map((v) => v[2]);
+      //     // 立方体8个顶点
+      //     const vertices = [
+      //       [x, y, z],
+      //       [x + barWidth, y, z],
+      //       [x + barWidth, y + barWidth, z],
+      //       [x, y + barWidth, z],
+      //       [x, y, z + height],
+      //       [x + barWidth, y, z + height],
+      //       [x + barWidth, y + barWidth, z + height],
+      //       [x, y + barWidth, z + height],
+      //     ];
 
-          const i = faces.map((f) => f[0]);
-          const j = faces.map((f) => f[1]);
-          const k = faces.map((f) => f[2]);
+      //     // 每个立方体的面(两个三角形组成一个面)
+      //     const faces = [
+      //       [0, 1, 2],
+      //       [0, 2, 3], // bottom
+      //       [4, 5, 6],
+      //       [4, 6, 7], // top
+      //       [0, 1, 5],
+      //       [0, 5, 4], // front
+      //       [1, 2, 6],
+      //       [1, 6, 5], // right
+      //       [2, 3, 7],
+      //       [2, 7, 6], // back
+      //       [3, 0, 4],
+      //       [3, 4, 7], // left
+      //     ];
 
-          traces.push({
-            type: "mesh3d",
-            x: xVals,
-            y: yVals,
-            z: zVals,
-            i,
-            j,
-            k,
-            opacity: 1,
-            color: `rgb(${50 + xi * 50}, ${100 + yi * 50}, 200)`,
-            flatshading: true,
-            showscale: false,
-          });
-        }
-      }
+      //     // 拆解为 Plotly mesh3d 的输入格式
+      //     const xVals = vertices.map((v) => v[0]);
+      //     const yVals = vertices.map((v) => v[1]);
+      //     const zVals = vertices.map((v) => v[2]);
+
+      //     const i = faces.map((f) => f[0]);
+      //     const j = faces.map((f) => f[1]);
+      //     const k = faces.map((f) => f[2]);
+
+      //     traces.push({
+      //       type: "mesh3d",
+      //       x: xVals,
+      //       y: yVals,
+      //       z: zVals,
+      //       i,
+      //       j,
+      //       k,
+      //       opacity: 1,
+      //       color: `rgb(${50 + xi * 50}, ${100 + yi * 50}, 200)`,
+      //       flatshading: true,
+      //       showscale: false,
+      //     });
+      //   }
+      // }
 
-      const layout = {
-        scene: {
-          xaxis: {
-            title: "X",
-            tickvals: [0.4, 1.4, 2.4],
-            ticktext: xLabels,
-          },
-          yaxis: {
-            title: "Y",
-            tickvals: [0.4, 1.4, 2.4],
-            ticktext: yLabels,
-          },
-          zaxis: { title: "Z" },
-          aspectratio: {
-            x: 2.2,
-            y: 1.7,
-            z: 1,
-          },
-          bgcolor: "#e5ecf6",
-          aspectmode: "manual",
-          gridcolor: "#fff",
-          camera: {
-            up: {
-              x: 0.200292643688136,
-              y: 0.2488259353493132,
-              z: 0.947612004346693,
-            },
-            center: {
-              x: -0.052807476121180814,
-              y: 0.02451796399554085,
-              z: -0.022911006648570736,
-            },
-            eye: {
-              x: -2.126379643342493,
-              y: -2.551422475965373,
-              z: 1.0917667684145647,
-            },
-            projection: {
-              type: "orthographic",
-            },
-          },
-          staticPlot: false,
-          showlegend: true,
-          legend: {
-            itemsizing: "constant", // ✅ 统一图例 marker 大小
-            font: {
-              size: 12,
-            },
-            marker: {
-              size: 10,
-            },
-          },
-        },
-        margin: { t: 50, b: 50, l: 50, r: 50 },
-      };
+      // const layout = {
+      //   scene: {
+      //     xaxis: {
+      //       title: "X",
+      //       tickvals: [0.4, 1.4, 2.4],
+      //       ticktext: xLabels,
+      //     },
+      //     yaxis: {
+      //       title: "Y",
+      //       tickvals: [0.4, 1.4, 2.4],
+      //       ticktext: yLabels,
+      //     },
+      //     zaxis: { title: "Z" },
+      //     aspectratio: {
+      //       x: 2.2,
+      //       y: 1.7,
+      //       z: 1,
+      //     },
+      //     bgcolor: "#e5ecf6",
+      //     aspectmode: "manual",
+      //     gridcolor: "#fff",
+      //     camera: {
+      //       up: {
+      //         x: 0.200292643688136,
+      //         y: 0.2488259353493132,
+      //         z: 0.947612004346693,
+      //       },
+      //       center: {
+      //         x: -0.052807476121180814,
+      //         y: 0.02451796399554085,
+      //         z: -0.022911006648570736,
+      //       },
+      //       eye: {
+      //         x: -2.126379643342493,
+      //         y: -2.551422475965373,
+      //         z: 1.0917667684145647,
+      //       },
+      //       projection: {
+      //         type: "orthographic",
+      //       },
+      //     },
+      //     staticPlot: false,
+      //     showlegend: true,
+      //     legend: {
+      //       itemsizing: "constant", // ✅ 统一图例 marker 大小
+      //       font: {
+      //         size: 12,
+      //       },
+      //       marker: {
+      //         size: 10,
+      //       },
+      //     },
+      //   },
+      //   margin: { t: 50, b: 50, l: 50, r: 50 },
+      // };
 
-      Plotly.newPlot("plot", traces, layout);
+      // Plotly.newPlot("plot", traces, layout);
     </script>
   </body>
 </html>

+ 1 - 0
src/assets/js/constants/echarts-config/roseChart.js

@@ -12,6 +12,7 @@ export const option = {
   },
   legend: {
     top: "bottom",
+    show: false,
   },
   radiusAxis: {},
   polar: {},

+ 2 - 3
src/views/performance/components/custonAsCom/dataTable.vue

@@ -1,8 +1,8 @@
 <!--
  * @Author: your name
  * @Date: 2024-10-28 16:46:38
- * @LastEditTime: 2025-09-11 14:37:30
- * @LastEditors: bogon
+ * @LastEditTime: 2025-09-17 14:51:24
+ * @LastEditors: milo-MBP
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/custonAsCom/dataTable.vue
 -->
@@ -162,7 +162,6 @@ export default {
         const getRequest = store.getAll();
         getRequest.onsuccess = () => {
           const data = getRequest.result;
-
           // 假设文件数据在 data[0].data 中
           let updatedData = data[0]?.data || [];
 

+ 3 - 2
src/views/performance/components/custonAsCom/dragChart/components/chartConfig/form/toolbox.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2025-08-14 11:28:28
- * @LastEditTime: 2025-08-29 15:30:25
+ * @LastEditTime: 2025-09-25 15:00:45
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/custonAsCom/dragChart/components/chartConfig/form/toolbox.vue
@@ -213,6 +213,7 @@ export default {
       } else if (
         [
           "bar",
+          "lineHighlight",
           "line",
           "radar",
           "scatter",
@@ -264,7 +265,7 @@ export default {
           background: this.curEdit.option.backgroundColor
             ? this.curEdit.option.backgroundColor
             : "transparent",
-          dataColor: [],
+          dataColor: this.curEdit.option.color || [],
         });
         // 查找是否存在数据
       } else {

+ 1 - 2
src/views/performance/components/custonAsCom/luckySheet.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <!-- UniverSheet -->
+    <!-- UniverSheet 升级后的代码-->
     <el-row type="flex" class="row-bg" justify="space-between">
       <el-col>
         <el-button
@@ -115,7 +115,6 @@ export default {
     // 剪掉底部和右侧全空的行/列
     trimEmptyRowsCols(values) {
       if (!Array.isArray(values) || values.length === 0) return [];
-
       // 去掉底部全空行
       let lastRow = values.length - 1;
       while (lastRow >= 0) {

+ 1 - 0
src/views/performance/components/custonAsCom/luckySheet1.vue

@@ -1,4 +1,5 @@
 <template>
+  <!-- luckysheet 原始代码 -->
   <div>
     <el-row type="flex" class="row-bg" justify="space-between">
       <el-col>