Browse Source

【BI商业智能】【饼图其他】【隐藏判断】

zhaoy 6 years ago
parent
commit
5c209a0f0f

+ 9 - 0
bi-server/src/main/java/com/usoftchina/bi/server/model/vo/configVo/PieConfigInfo.java

@@ -14,6 +14,15 @@ public class PieConfigInfo {
     private List<String> groups;
     private String sort;
     private String rule;
+    private boolean hiddenOther;
+
+    public boolean isHiddenOther() {
+        return hiddenOther;
+    }
+
+    public void setHiddenOther(boolean hiddenOther) {
+        this.hiddenOther = hiddenOther;
+    }
 
     public List<String> getGroups() {
         return groups;

+ 2 - 1
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowPieService.java

@@ -63,6 +63,7 @@ public class ShowPieService {
                yAxisType = CalculationJudgeUtil.Judge(yType),
                sort = StringUtils.isEmpty(pieConfigInfo.getSort()) ? xColumn : pieConfigInfo.getSort(),
                rule = StringUtils.isEmpty(pieConfigInfo.getRule()) ? "ASC" : pieConfigInfo.getRule();
+        boolean hiddenOther = pieConfigInfo.isHiddenOther();
         List<String> groupBy = pieConfigInfo.getGroups(),         //分组
                      xAxisData = new ArrayList<String>();       //X轴自己用
         PieSeries series = new PieSeries();
@@ -151,7 +152,7 @@ public class ShowPieService {
                     chartsDataInfo.setTooMany(true);
                     value = new ArrayList<>(value.stream().collect(Collectors.toList()).subList(0, pieConfigInfo.getMaxCount()));
                     Optional<Double> part = value.stream().map(PieSeriesMap::getValue).reduce(Double::sum);
-                    if (total.isPresent() && part.isPresent()) {
+                    if (total.isPresent() && part.isPresent() && hiddenOther==false) {
                         value.add(new PieSeriesMap(total.get() - part.get(), "其它"));
                     }
                 }