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 }) })