From 1e34ddcbe60b5b5456edc923e5e6c6fc2620d8db Mon Sep 17 00:00:00 2001 From: zhoule Date: Sun, 18 Feb 2024 10:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=84=9F=E7=9F=A5=E4=BA=8B=E4=BB=B6=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/dailyDisposal/assets/charts.js | 6 +++++- .../components/dailyDisposal/index.vue | 21 ++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/assets/charts.js b/ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/assets/charts.js index cf553c78..2fd64d5b 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/assets/charts.js +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/assets/charts.js @@ -44,8 +44,12 @@ var options = { } }, formatter: (params) => { + let count = 0; + echartsData.forEach((it) => { + count += it.value; + }) let obj = echartsData.filter(it => { return it.name == params }) - return `{ast|${obj[0].name}} {bst|${Math.round(obj[0].value)}%}` + return `{ast|${obj[0].name}} {bst|${Math.round(obj[0].value / count * 100)}%}` }, data: echartsData?.map(x => x), }, diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/index.vue index e7552bb8..d3e46290 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dailyDisposal/index.vue @@ -55,8 +55,14 @@ export default { getWarningStateDay().then(res => { if (res.code == 200) { let data = res.data; - if (data.lemgth > 0) { + if (data.length > 0) { window.echartsData = []; + + // let count = 0; + // data.forEach((it) => { + // count += it.number; + // }) + for (let i = 0; i < data.length; i++) { let it = data[i]; if (it.warningState == 1) { @@ -89,11 +95,6 @@ export default { } - let count = 0; - - echartsData.forEach((it) => { - count += it.value; - }) chartsStatistics.legend.data = window.echartsData?.map(x => x); chartsStatistics.series[0].data = echartsData.map((item, index) => { @@ -140,10 +141,10 @@ export default { context.lineWidth = 1; // 设置线段宽度 // 绘制圆角矩形 - drawRoundRect(context, 272, 50, 120, 24, 12, gr) - drawRoundRect(context, 272, 78, 120, 24, 12, gr) - drawRoundRect(context, 272, 106, 120, 24, 12, gr) - + drawRoundRect(context, 270, 36, 120, 24, 12, gr) + drawRoundRect(context, 270, 63, 120, 24, 12, gr) + drawRoundRect(context, 270, 90, 120, 24, 12, gr) + drawRoundRect(context, 270, 117, 120, 24, 12, gr) }); }); },