From 004711c8d851c16dc644d1860c6b6e410890d95a Mon Sep 17 00:00:00 2001 From: shijingjing <1789544664@qq.com> Date: Fri, 30 Dec 2022 14:25:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=B1=E7=8A=B6=E5=9B=BE=E5=92=8C=E7=8E=AF?= =?UTF-8?q?=E7=8A=B6=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../saas/AppDataStatistics/components/resident.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/project/saas/AppDataStatistics/components/resident.vue b/src/project/saas/AppDataStatistics/components/resident.vue index 74fd989c..fd9cf1c8 100644 --- a/src/project/saas/AppDataStatistics/components/resident.vue +++ b/src/project/saas/AppDataStatistics/components/resident.vue @@ -74,6 +74,10 @@ export default { this.ageFlag = !this.ageArray.every(e=> e==0) this.sexArray = res.data.男女比例.map(v=> v.v2) this.sexFlag = !this.sexArray.every(e=> e==0) + this.$nextTick(()=> { + this.getAgeEcherts(this.ageArray) + this.getAgeProportion() + }) } }) }, @@ -143,7 +147,7 @@ export default { option && myChart.setOption(option); }, // 年龄分布 - getAgeEcherts() { + getAgeEcherts(ageArray) { let ageDom = document.getElementById('ageEcharts'); let myChart = echarts.init(ageDom); let option; @@ -163,7 +167,7 @@ export default { }, series: [ { - data: this.ageArray, + data: ageArray, type: 'bar', itemStyle: { normal: { @@ -243,9 +247,9 @@ export default { maxSurfaceAngle: 80 }, data: [ - { value: this.sexArray[1]?.v2, name: '男' }, - { value: this.sexArray[0]?.v2, name: '女' }, - ] + { value: this.sexArray?.[1] , name: '男' }, + { value: this.sexArray?.[0] , name: '女' }, + ] } ] };