From 1dbdda3517a01851d8d9894b22e61aa4462b541c Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期四, 07 十二月 2023 19:16:36 +0800
Subject: [PATCH] tooltip值优化

---
 src/views/cockpitPage/components/DeviceChart.vue |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/views/cockpitPage/components/DeviceChart.vue b/src/views/cockpitPage/components/DeviceChart.vue
index 79d1705..a88e6be 100644
--- a/src/views/cockpitPage/components/DeviceChart.vue
+++ b/src/views/cockpitPage/components/DeviceChart.vue
@@ -65,6 +65,9 @@
             axisPointer: {
               type: "none",
             },
+            valueFormatter: function (value) {
+              return value + "%";
+            },
           },
           grid: {
             right: "80px",
@@ -79,6 +82,9 @@
               show: false,
               startValue: that.startValue, // 浠庡ご寮�濮�
               endValue: that.endValue, // 涓�娆℃�у睍绀哄嚑涓�
+              zoomOnMouseWheel: false,
+              moveOnMouseWheel: true,
+              moveOnMouseMove: true,
             },
           ],
           legend: {
@@ -104,7 +110,7 @@
                 // rotate:45,
                 margin: 10,
                 show: true,
-                fontSize:12,
+                fontSize: 12,
                 textStyle: {
                   color: function (params, index) {
                     let colorList = ["#dcb018", "#00FFFF"];
@@ -154,12 +160,13 @@
               axisTick: {
                 show: false,
               },
-
               axisLabel: {
                 textStyle: {
                   color: "#00FFFF",
                 },
-                formatter: "{value}%",
+                formatter: function (value) {
+                  return `${value}%`;
+                },
               },
             },
           ],
@@ -171,7 +178,21 @@
               label: {
                 show: true,
                 position: "right",
-                color: "#00FFFF",
+                formatter: function (params) {
+                  if (params.dataIndex % 2 == 0) {
+                    return `{a|${params.value}%}`;
+                  } else {
+                    return `{b|${params.value}%}`;
+                  }
+                },
+                rich: {
+                  a: {
+                    color: "#00FFFF",
+                  },
+                  b: {
+                    color: "#dcb018",
+                  },
+                },
               },
               itemStyle: {
                 normal: {

--
Gitblit v1.8.0