Ver Fonte

柱状图X轴取数BUG

chenw há 6 anos atrás
pai
commit
46561e4ec1

+ 2 - 2
bi-server/src/main/java/com/usoftchina/bi/server/dao/chart/ShowChartsMapper.java

@@ -34,10 +34,10 @@ public interface ShowChartsMapper {
                      @Param("xdata") String xdata, @Param("screen") String screen);
 
     //x轴数据 -> 优化后
-    @Select("select ${dataType}(${yAxisName}) from ${tableName} where 1=1 ${screen} GROUP BY ${xColumn}")
+    @Select("select ${dataType}(${yAxisName}) from ${tableName} where 1=1 ${screen} and ${xColumn} in (select * from (select DISTINCT ${xColumn} from ${tableName} ${screenToColumn}) where rownum <= #{num}) GROUP BY ${xColumn}")
     List<Double> getValues(@Param("yAxisName") String yAxisName, @Param("xColumn") String xColumn,
                     @Param("tableName") String tableName, @Param("dataType") String dataType,
-                    @Param("screen") String screen);
+                    @Param("screen") String screen, @Param("screenToColumn") String screenToColumn, @Param("num") int num);
 
     //x轴数据 -> 饼图优化后
     @Select("select ${dataType}(${yAxisName}) value, ${xColumn} name from ${tableName} where 1=1 ${screen} GROUP BY ${xColumn}")

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

@@ -141,7 +141,7 @@ public class ShowHistogramService {
             if ("time".equals(xColumnType)){        //如果是时间类型
                 value = timeConverterUtil.getHistogramTimeValue(yColumn, xColumn, tableName, yAxisType, xAxisType, xAxisData, screenToColumnS);
             }else {
-                value = showChartsMapper.getValues(yColumn, xColumn, tableName, yAxisType, screenToColumnS);
+                value = showChartsMapper.getValues(yColumn, xColumn, tableName, yAxisType, screenToColumnS, screen, histogramConfigInfo.getMaxCount());
             }
 
             series.setName(xColumn);