rui.jiang 2 tháng trước cách đây
mục cha
commit
38943a44ee

+ 2 - 2
src/components/map/index.vue

@@ -223,9 +223,9 @@ export default {
       layers: [
         new TileLayer({
           source: new XYZ({
-            // url: "http://106.120.102.238:18000/tiles/{z}/{x}/{y}.png", //外网
+            url: "http://106.120.102.238:18000/tiles/{z}/{x}/{y}.png", //外网
             // url: "http://127.0.0.1:8010/tiles/{z}/{x}/{y}.png", //本地
-            url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //内网
+            // url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //内网
             // url: "http://10.96.137.5:9080/tiles/{z}/{x}/{y}.png", //大~#@唐
           }),
         }),

+ 38 - 14
src/views/performance/components/chartsCom/3DDrawingChart.vue

@@ -88,10 +88,6 @@ export default {
     };
   },
   mixins: [myMixin],
-  async mounted() {
-    this.getData();
-    this.color1 = this.themeColor;
-  },
   computed: {
     ...mapState("themes", {
       themeColor: "themeColor",
@@ -99,8 +95,12 @@ export default {
   },
   watch: {
     themeColor: {
-      handler() {
-        this.color1 = this.themeColor;
+      handler(newval) {
+        if (newval.length === 0) {
+          this.color1 = colorSchemes[0].colors;
+        } else {
+          this.color1 = newval;
+        }
         this.updateChartColor();
       },
       deep: true,
@@ -112,6 +112,14 @@ export default {
       deep: true,
     },
   },
+  async mounted() {
+    this.getData();
+    if (this.themeColor.length === 0) {
+      this.color1 = colorSchemes[0].colors;
+    } else {
+      this.color1 = this.themeColor;
+    }
+  },
   methods: {
     async getData() {
       if (this.fileAddr !== "") {
@@ -203,11 +211,27 @@ export default {
         };
         return trace;
       });
-      const yData = [...new Set(this.chartData.data[0].yData)]; // 获取机组编号
-      const ticktext = yData;
-      const tickvals = yData.map((_, index) => index + 1); // 让 tickvals 均匀分布
+      const yData = [...new Set(this.chartData.data[0].yData)]; // 获取唯一的yData
+      const totalTicks = 10; // 想要显示的刻度数量
 
-      console.log(ticktext, "tickvals", tickvals);
+      // 保证第一个和最后一个刻度
+      const firstValue = yData[0];
+      const lastValue = yData[yData.length - 1];
+
+      // 计算中间部分的刻度值
+      const interval = Math.floor((yData.length - 1) / 8); // 总长度减去最初和最后一个,计算间隔
+
+      // 选择需要展示的刻度
+      const tickvals = [firstValue]; // 先将第一个值放入刻度数组
+
+      for (let i = 1; i < totalTicks - 1; i++) {
+        const index = i * interval;
+        tickvals.push(yData[index]);
+      }
+
+      tickvals.push(lastValue); // 最后将最后一个值放入刻度数组
+
+      const ticktext = tickvals;
       const layout = {
         title: {
           text: this.chartData.data[0].title,
@@ -216,7 +240,6 @@ export default {
             weight: "bold",
           },
         },
-
         scene: {
           xaxis: {
             title: this.chartData.xaixs,
@@ -234,10 +257,11 @@ export default {
           },
           yaxis: {
             title: this.chartData.yaixs,
-            tickvals: [...new Set(this.chartData.data[0].yData)],
-            ticktext: [...new Set(this.chartData.data[0].yData)],
             type: "category", // 让 Y 轴按类别均匀分布
-            categoryorder: "category ascending", // 按类别字母顺序排列
+            categoryorder: "array", // 自定义顺序,确保间隔均匀
+            categoryarray: [...new Set(this.chartData.data[0].yData)], // 以原始数据顺序排序
+            tickvals: tickvals,
+            ticktext: ticktext,
             gridcolor: "rgb(255,255,255)",
             tickcolor: "rgb(255,255,255)",
             backgroundcolor: "#CFD4DC",

+ 2 - 1
src/views/performance/components/chartsCom/BarChart.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2024-09-11 14:30:17
- * @LastEditTime: 2025-03-21 14:20:42
+ * @LastEditTime: 2025-03-21 16:56:16
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/chartsCom/BarChart.vue
@@ -139,6 +139,7 @@ export default {
         xaxis: {
           title: this.chartData.xaixs || "X轴", // 横坐标标题
           gridcolor: "rgb(255,255,255)",
+          type: this.chartData.xaixs === "机组" ? "category" : undefined, // 让 Y 轴按类别均匀分布
           tickcolor: "rgb(255,255,255)",
           backgroundcolor: "#e5ecf6",
         },

+ 1 - 0
src/views/performance/components/chartsCom/BoxLineCharts.vue

@@ -205,6 +205,7 @@ export default {
         xaxis: {
           title: this.chartData.xaixs,
           tickmode: "array",
+          type: "category", // 让 Y 轴按类别均匀分布
           gridcolor: "rgb(255,255,255)",
           tickcolor: "rgb(255,255,255)",
           backgroundcolor: "#e5ecf6",

+ 2 - 9
src/views/performance/components/chartsCom/ColorbarInitTwoDmarkersChart.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2025-03-14 10:30:00
- * @LastEditTime: 2025-03-21 14:55:21
+ * @LastEditTime: 2025-03-21 17:39:36
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/chartsCom/colorbarInitTwoDmarkersChart.vue
@@ -10,14 +10,7 @@
   <div style="width: 100%; height: 600px">
     <!-- 2D散点图 -->
     <div style="display: flex; align-items: center; padding-top: 20px">
-      <div
-        style="
-          margin-right: 20px;
-          margin-top: 30px;
-          display: flex;
-          align-items: center;
-        "
-      >
+      <div style="margin-right: 20px; display: flex; align-items: center">
         <el-select
           size="small"
           v-model="color1"

+ 4 - 1
src/views/performance/components/chartsCom/FaultUnit.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2025-01-15 15:49:57
- * @LastEditTime: 2025-03-17 14:11:09
+ * @LastEditTime: 2025-03-21 15:36:12
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/chartsCom/FaultUntal.vue
@@ -86,6 +86,8 @@ export default {
           tickvals: this.faultTypes.slice(0, 10), // 保证这里是字符串数组
           ticktext: this.faultTypes.slice(0, 10), // 确保 ticktext 使用相同的标签
           tickfont: { size: 12 },
+          type: "category", // 让 Y 轴按类别均匀分布
+          // categoryorder: "category ascending", // 按类别字母顺序排列
           gridcolor: "rgb(255,255,255)",
           tickcolor: "rgb(255,255,255)",
           backgroundcolor: "#e5ecf6",
@@ -105,6 +107,7 @@ export default {
           title: "故障时长(秒)",
           titlefont: { color: "#1A295D" },
           tickfont: { color: "#1A295D" },
+          showgrid: false, // 隐藏 Y 轴网格线
           overlaying: "y", // 在第一个 Y 轴上方绘制
           side: "right", // 右侧的 Y 轴
           position: 1, // 调整右侧轴的位置