Browse Source

处理Y轴数据为空情况

chenw 6 years ago
parent
commit
e83d722a1f

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

@@ -115,7 +115,7 @@ public class ShowHistogramService {
                 sort = yAxisType + "(" + yColumn + ")";
             }
             String fieldName = yAxisType
-                    + "(" + yColumn + ") as value,"
+                    + "(nvl(" + yColumn + ",0)) as value,"
                     + ("scale".equals(xColumnType) ? "nvl(" + xColumn + ",0)" : "nvl(" + xColumn + ",'空')")
                     + " as name ";
             String condition = screenToColumnS + " GROUP BY " + xColumn;

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

@@ -92,7 +92,7 @@ public class ShowLineService {
                 screenToColumnS = " 1 = 1 ";
             }
             xColumn = TimeConverterUtil.convertToOracleDateStr(xColumn, xAxisType);         //X轴 -> 折线图X轴只能为日期类型
-            String fieldName = yAxisType + "(" + yColumn + ") as value,nvl(" + xColumn + ",'空') as name ";
+            String fieldName = yAxisType + "(nvl(" + yColumn + ",0)) as value,nvl(" + xColumn + ",'空') as name ";
             String condition = screenToColumnS + " GROUP BY " + xColumn;
             String sort = xColumn, rule = "ASC";
             if (CollectionUtils.isEmpty(groupBy)) {

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

@@ -100,7 +100,10 @@ public class ShowPieService {
             if ("time".equals(xColumnType)) {
                 xColumn = TimeConverterUtil.convertToOracleDateStr(xColumn, xAxisType);
             }
-            String fieldName = yAxisType + "(" + yColumn + ") as value,nvl(" + xColumn + ",'空') as name ";
+            String fieldName = yAxisType
+                    + "(nvl(" + yColumn + ",0)) as value,"
+                    + ("scale".equals(xColumnType) ? "nvl(" + xColumn + ",0)" : "nvl(" + xColumn + ",'空')")
+                    + " as name ";
             String condition = screenToColumnS + " GROUP BY " + xColumn;
             value = showChartsMapper.getPieValueWithoutGroup(fieldName, tableName, condition);
             xAxisData = value.stream().sorted(Comparator.comparing(PieSeriesMap::getValue)).map(PieSeriesMap::getName).collect(Collectors.toList());

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

@@ -101,7 +101,7 @@ public class ShowScatterService {
                 xColumn = TimeConverterUtil.convertToOracleDateStr(xColumn, xAxisType);         //X轴
             }
             String fieldName = yAxisType
-                    + "(" + yColumn + ") as value,"
+                    + "(nvl(" + yColumn + ",0)) as value,"
                     + ("scale".equals(xColumnType) ? "nvl(" + xColumn + ",0)" : "nvl(" + xColumn + ",'空')")
                     + " as \"date\" ";
             String condition = screenToColumnS + " GROUP BY " + xColumn;