From 7baf391790a0b0fa0cc42ebcdf6284d168d5fadc Mon Sep 17 00:00:00 2001 From: OathK1per Date: Tue, 15 Nov 2022 17:30:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=BA=E9=97=B4=E7=AE=A1=E7=90=86=E6=9F=B1?= =?UTF-8?q?=E7=8A=B6=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/palmte/work/service/SpaceService.java | 3 +++ .../templates/admin/space_statistics.ftl | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/java/cn/palmte/work/service/SpaceService.java b/src/main/java/cn/palmte/work/service/SpaceService.java index ef18242..174cf2e 100644 --- a/src/main/java/cn/palmte/work/service/SpaceService.java +++ b/src/main/java/cn/palmte/work/service/SpaceService.java @@ -7,6 +7,7 @@ import cn.palmte.work.model.SysRole; import cn.palmte.work.model.SysRoleRepository; import cn.palmte.work.pojo.SpaceVO; import cn.palmte.work.utils.InterfaceUtil; +import cn.palmte.work.utils.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -151,6 +152,8 @@ public class SpaceService { private SpaceVO combineData(List pie, List bar) { Map map = pie.stream().collect(Collectors.toMap(record -> String.valueOf(record.getInt("certainty")), Function.identity())); + bar = bar.stream().peek(a -> a.set("average", Utils.format(a.getBigDecimal("average")))).collect(Collectors.toList()); + SpaceVO spaceVO = new SpaceVO(); spaceVO.setMap(map); spaceVO.setList(bar); diff --git a/src/main/resources/templates/admin/space_statistics.ftl b/src/main/resources/templates/admin/space_statistics.ftl index 929b4c5..bcb7e72 100644 --- a/src/main/resources/templates/admin/space_statistics.ftl +++ b/src/main/resources/templates/admin/space_statistics.ftl @@ -90,7 +90,10 @@ text: '项目金额及平均毛利率情况' }, tooltip: { - trigger: 'axis' + trigger: 'axis', + axisPointer: { + type: 'shadow' + } }, color:[colors[0], colors[1]], xAxis: { @@ -134,7 +137,7 @@ } }, axisLabel: { - formatter: '{value}' + formatter: '{value}%' }, minInterval: 1, max: function(value) { @@ -146,12 +149,23 @@ { type: 'bar', yAxisIndex: 0, - data: [] + data: [], + label: { + show: true, + position: 'inside', + color: 'black' + } }, { type: 'bar', yAxisIndex: 1, - data: [] + data: [], + label: { + show: true, + position: 'inside', + color: 'black', + formatter: '{c}%' + } } ] };