From ce4cb1a1f50591ef89da10662ca31e97ffe12611 Mon Sep 17 00:00:00 2001
From: zrj <646384940@qq.com>
Date: Sat, 09 Nov 2024 12:07:30 +0800
Subject: [PATCH] 统计样式修改
---
src/views/survey/components/box/fireContent.vue | 120 ++++++++++++++++++++----------------------------------------
1 files changed, 40 insertions(+), 80 deletions(-)
diff --git a/src/views/survey/components/box/fireContent.vue b/src/views/survey/components/box/fireContent.vue
index 4a3d506..3168fc4 100644
--- a/src/views/survey/components/box/fireContent.vue
+++ b/src/views/survey/components/box/fireContent.vue
@@ -27,7 +27,7 @@
{
name: '一般',
itemStyle: {
- color: '#FFFF00'
+ color: '#3579F6'
}
},
{
@@ -46,105 +46,65 @@
function getRiskSource () {
getRiskSourceStatistic().then(res => {
- let xaxis_data = []
- let yaxis_data = []
- let seriesData = []
- res.data.data.forEach(element => {
- xaxis_data.push(element.riskLevel)
- yaxis_data.push({
- name: element.riskLevel,
- value: element.num
+ let data = res.data.data
+ let dataRsult = []
+ var total = 0;
+ data.forEach(item => {
+ dataRsult.push({
+ name: item.riskLevel,
+ value: item.num,
+ itemStyle: typeLevel.find(i => i.name == item.riskLevel).itemStyle
})
-
- seriesData.push({
- name: element.riskLevel,
- type: 'bar',
- data: [],
- barWidth: '30',
- barGap: '-100%',
- itemStyle: typeLevel.find(i => i.name == element.riskLevel).itemStyle
- })
- })
-
- seriesData = seriesData.map(item => {
- return {
- ...item,
- data: yaxis_data.map(i => {
- return i.name == item.name ? i.value : 0
- })
- }
+ total = total + item.num;
})
myEcharts.setOption({
+ title: {
+ text: "总数",
+ subtext: String(total),
+ textStyle: {
+ fontSize: 16,
+ color: "#fff",
+ lineHeight: 20,
+ },
+ subtextStyle: {
+ fontSize: 28,
+ color: "#fff",
+ },
+ textAlign: "center",
+ right: "43%",
+ top: "36%",
+ },
legend: {
- data: xaxis_data,
- top: "5%",
- right: "5%",
+ orient: "vertical",
+ top: '8%',
+ right: "8%",
textStyle: {
color: '#fff'
}
},
- tooltip: {
- axisPointer: {
- type: 'shadow'
- }
- },
-
grid: {
- top: '16%',
+ top: '6%',
left: '6%',
right: '6%',
bottom: '6%',
containLabel: true
},
- xAxis: [
- {
- type: 'category',
- data: xaxis_data,
- nameTextStyle: {
- color: '#fff'
- },
- axisLine: {
- lineStyle: {
- color: '#fff'
- }
- },
- axisTick: {
- alignWithLabel: true,
- lineStyle: {
- color: '#fff'
- }
- },
- axisLabel: {
- color: '#fff'
- },
- }
- ],
+ tooltip: {
+ trigger: 'item'
+ },
- yAxis: [
+ series: [
{
- type: 'value',
- nameTextStyle: {
- color: '#fff'
- },
- axisLine: {
- lineStyle: {
- color: '#fff'
- }
- },
- axisTick: {
- lineStyle: {
- color: '#fff'
- }
- },
- axisLabel: {
- color: '#fff'
- },
+ // name: 'Access From',
+ type: 'pie',
+ left: '-5%',
+ radius: ['45%', '75%'],
+ data: dataRsult
}
- ],
- series: seriesData
+ ]
})
})
}
--
Gitblit v1.9.3