From 7a9efc72a8baf3c85bf62ac6222433b095f7704a Mon Sep 17 00:00:00 2001 From: hzz Date: Thu, 8 Jun 2023 16:12:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=8B=E5=8A=BF=E5=9B=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/TrendChart/index.vue | 3 +++ src/views/TrendChart/lineChart.vue | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/views/TrendChart/index.vue b/src/views/TrendChart/index.vue index 8d912eb..d32d3f4 100644 --- a/src/views/TrendChart/index.vue +++ b/src/views/TrendChart/index.vue @@ -62,6 +62,9 @@ async function ajax() { let tempData = {} res.data.forEach((item: any) => { + if (unit) { + item.name = item.name + '(' + unit + ')' + } if (tempData.hasOwnProperty(item.id)) { tempData[item.id].data.push({ name: item.type, diff --git a/src/views/TrendChart/lineChart.vue b/src/views/TrendChart/lineChart.vue index 87bad6d..33fbaa4 100644 --- a/src/views/TrendChart/lineChart.vue +++ b/src/views/TrendChart/lineChart.vue @@ -77,11 +77,7 @@ function init() { watch(() => prop.calc.data, (newVal) => { data = newVal myChart.setOption({ - series: [ - { - data: data - } - ] + series: data }) })