空间管理柱状图

master
OathK1per 2022-11-15 17:30:33 +08:00
parent f66ced6631
commit 7baf391790
2 changed files with 21 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import cn.palmte.work.model.SysRole;
import cn.palmte.work.model.SysRoleRepository; import cn.palmte.work.model.SysRoleRepository;
import cn.palmte.work.pojo.SpaceVO; import cn.palmte.work.pojo.SpaceVO;
import cn.palmte.work.utils.InterfaceUtil; import cn.palmte.work.utils.InterfaceUtil;
import cn.palmte.work.utils.Utils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -151,6 +152,8 @@ public class SpaceService {
private SpaceVO combineData(List<Record> pie, List<Record> bar) { private SpaceVO combineData(List<Record> pie, List<Record> bar) {
Map<String, Record> map = pie.stream().collect(Collectors.toMap(record -> String.valueOf(record.getInt("certainty")), Function.identity())); Map<String, Record> 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 spaceVO = new SpaceVO();
spaceVO.setMap(map); spaceVO.setMap(map);
spaceVO.setList(bar); spaceVO.setList(bar);

View File

@ -90,7 +90,10 @@
text: '项目金额及平均毛利率情况' text: '项目金额及平均毛利率情况'
}, },
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis',
axisPointer: {
type: 'shadow'
}
}, },
color:[colors[0], colors[1]], color:[colors[0], colors[1]],
xAxis: { xAxis: {
@ -134,7 +137,7 @@
} }
}, },
axisLabel: { axisLabel: {
formatter: '{value}' formatter: '{value}%'
}, },
minInterval: 1, minInterval: 1,
max: function(value) { max: function(value) {
@ -146,12 +149,23 @@
{ {
type: 'bar', type: 'bar',
yAxisIndex: 0, yAxisIndex: 0,
data: [] data: [],
label: {
show: true,
position: 'inside',
color: 'black'
}
}, },
{ {
type: 'bar', type: 'bar',
yAxisIndex: 1, yAxisIndex: 1,
data: [] data: [],
label: {
show: true,
position: 'inside',
color: 'black',
formatter: '{c}%'
}
} }
] ]
}; };