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 => {