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}%' + } } ] };