From 7a829fcac6770136e279f1cc8dca098d916853a0 Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Sat, 26 Aug 2023 13:08:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=AA=E5=9D=90=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Progress.vue | 27 +++++++++------------------ src/store/modules/echarts.js | 7 +++++++ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/components/Progress.vue b/src/components/Progress.vue index 6bfbd63..db47bbe 100644 --- a/src/components/Progress.vue +++ b/src/components/Progress.vue @@ -132,10 +132,7 @@ const binOption = ref({ xAxis: { type: 'category', boundaryGap: false, - data: Array.from( - Array(Object.keys(echartsStore.binCharts).length), - (v, k) => k, - ), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', @@ -183,7 +180,7 @@ const envir1Option = ref({ xAxis: { type: 'category', boundaryGap: false, - data: Object.keys(echartsStore.envir1Charts), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', @@ -231,7 +228,7 @@ const envir2Option = ref({ xAxis: { type: 'category', boundaryGap: false, - data: Object.keys(echartsStore.envir2Charts), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', @@ -320,10 +317,7 @@ onMounted(() => { xAxis: { type: 'category', boundaryGap: false, - data: Array.from( - Array(Object.keys(echartsStore.binCharts).length), - (v, k) => k, - ), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', @@ -371,7 +365,7 @@ onMounted(() => { xAxis: { type: 'category', boundaryGap: false, - data: Object.keys(echartsStore.envir1Charts), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', @@ -419,7 +413,7 @@ onMounted(() => { xAxis: { type: 'category', boundaryGap: false, - data: Object.keys(echartsStore.envir2Charts), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', @@ -470,10 +464,7 @@ onMounted(() => { xAxis: { type: 'category', boundaryGap: false, - data: Array.from( - Array(Object.keys(echartsStore.binCharts).length), - (v, k) => k, - ), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', @@ -521,7 +512,7 @@ onMounted(() => { xAxis: { type: 'category', boundaryGap: false, - data: Object.keys(echartsStore.envir1Charts), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', @@ -569,7 +560,7 @@ onMounted(() => { xAxis: { type: 'category', boundaryGap: false, - data: Object.keys(echartsStore.envir2Charts), + data: echartsStore.abscissaFormater, }, yAxis: { type: 'value', diff --git a/src/store/modules/echarts.js b/src/store/modules/echarts.js index e56b9cc..c9181c9 100644 --- a/src/store/modules/echarts.js +++ b/src/store/modules/echarts.js @@ -22,6 +22,13 @@ export const useEchartsStore = defineStore({ }, }, getters: { + abscissaFormater(state) { + let arr = [] + Object.keys(state.binCharts).map((item, index) => { + arr.push(`${index}-${item}`) + }) + return arr + }, binTemp(state) { let arr = [] Object.values(state.binCharts).map(item => {