From d372f82db7bf15ed38f8faf2e6b90080f9343c04 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 06 十二月 2023 09:48:18 +0800
Subject: [PATCH] 显示字数修改
---
src/views/cockpitPage/components/BarChart.vue | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/views/cockpitPage/components/BarChart.vue b/src/views/cockpitPage/components/BarChart.vue
index 5f9262d..7126e77 100644
--- a/src/views/cockpitPage/components/BarChart.vue
+++ b/src/views/cockpitPage/components/BarChart.vue
@@ -54,11 +54,15 @@
// datay: [120, 200, 150, 180, 170, 150, 130, 180, 140],
// datay2: [20, 30, 50, 40, 70, 50, 30, 80, 40],
// },
+ startValue: 0,
+ endValue: 5,
chartTimer: null,
};
},
watch: {
"chartData.datay"(val) {
+ this.startValue = 0;
+ this.endValue = 5;
this.pieChart("chart", this.chartData);
},
},
@@ -129,8 +133,8 @@
type: "inside",
xAxisIndex: 0,
show: false,
- startValue: 0, // 浠庡ご寮�濮�
- endValue: 5, // 涓�娆℃�у睍绀哄嚑涓�
+ startValue: that.startValue, // 浠庡ご寮�濮�
+ endValue: that.endValue, // 涓�娆℃�у睍绀哄嚑涓�
},
],
legend: {
@@ -175,8 +179,8 @@
color: "#00FFFF",
},
formatter: function (value) {
- if (value.length > 5) {
- return `${value.slice(0, 4)}...`;
+ if (value.length > 4) {
+ return `${value.slice(0, 3)}...`;
}
return value;
},
@@ -285,8 +289,8 @@
this.chartTimer = setInterval(function () {
// 姣忔鍚戝乏婊戝姩涓�涓紝鏈�鍚庝竴涓粠澶村紑濮嬨��
if (option.dataZoom[0].endValue == that.chartData.datay.length) {
- option.dataZoom[0].startValue = 0;
- option.dataZoom[0].endValue = 5;
+ option.dataZoom[0].startValue = that.startValue;
+ option.dataZoom[0].endValue = that.endValue;
} else {
option.dataZoom[0].endValue = option.dataZoom[0].endValue + 1;
option.dataZoom[0].startValue = option.dataZoom[0].startValue + 1;
--
Gitblit v1.8.0