From deeef493e4055b96b5669aff3e4ff875012b9db4 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Sun, 21 Jan 2024 09:50:50 +0800 Subject: [PATCH] a --- src/views/astatistics/index.vue | 89 +++++++++++++++++++++++++++++- src/views/customer_demand/edit.vue | 2 +- 2 files changed, 87 insertions(+), 4 deletions(-) diff --git a/src/views/astatistics/index.vue b/src/views/astatistics/index.vue index 4aa1384..de115ba 100644 --- a/src/views/astatistics/index.vue +++ b/src/views/astatistics/index.vue @@ -330,14 +330,13 @@ var option = { } }, legend: { - data: ['Forest', 'Steppe', 'Desert', 'Wetland'] + data: ['名称', 'Steppe', 'Desert', 'Wetland'] }, toolbox: { show: true, orient: 'vertical', left: 'right', top: 'center', - }, xAxis: [ { @@ -694,6 +693,81 @@ let option3 = { +// 获取柱状图option +const setHistogramOption = (legend, xAxisData, series) => { + return { + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + // legend: { + // data: ['名称', 'Steppe', 'Desert', 'Wetland'] + // }, + legend, + toolbox: { + show: true, + orient: 'vertical', + left: 'right', + top: 'center', + }, + xAxis: [ + { + type: 'category', + axisTick: { show: false }, + // data: ['2012', '2013', '2014', '2015', '2016', '2012', '2013', '2014', '2015', '2016'] + data: xAxisData + } + ], + yAxis: [ + { + type: 'value' + } + ], + // series: [ + // // { + // // name: '名称', + // // type: 'bar', + // // barGap: 0, + // // label: labelOption, + // // emphasis: { + // // focus: 'series' + // // }, + // // data: [320, 332, 301, 334, 390] + // // }, + // // { + // // name: 'Steppe', + // // type: 'bar', + // // label: labelOption, + // // emphasis: { + // // focus: 'series' + // // }, + // // data: [220, 182, 191, 234, 290] + // // }, + // // { + // // name: 'Desert', + // // type: 'bar', + // // label: labelOption, + // // emphasis: { + // // focus: 'series' + // // }, + // // data: [150, 232, 201, 154, 190] + // // }, + // // { + // // name: 'Wetland', + // // type: 'bar', + // // label: labelOption, + // // emphasis: { + // // focus: 'series' + // // }, + // // data: [98, 77, 101, 99, 40] + // // } + // ] + series + } + +} @@ -705,7 +779,16 @@ const initChart = (id, opt) => { myChart.setOption(opt); } onMounted(() => { - initChart("customNum", customoption) + initChart("customNum", setHistogramOption({ data: ['名称'] }, ['2012', '2013', '2014', '2015', '2016', '2012', '2013', '2014', '2015', '2016'], [{ + name: '名称', + type: 'bar', + barGap: 0, + label: labelOption, + emphasis: { + focus: 'series' + }, + data: [320, 332, 301, 334, 390] + },])) initChart("projectApproved", option2) initChart("main", option3) diff --git a/src/views/customer_demand/edit.vue b/src/views/customer_demand/edit.vue index 7ace7f4..b36a171 100644 --- a/src/views/customer_demand/edit.vue +++ b/src/views/customer_demand/edit.vue @@ -34,7 +34,7 @@ + :rules="[{ required: true, message: '不可为空', trigger: 'change' }]">