diff --git a/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index adc6fe33ce..61f575449c 100644 --- a/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -604,12 +604,21 @@ public class ChartViewService { List viewFields = gson.fromJson(view.getViewFields(), tokenType); final Map> extFieldsMap = new LinkedHashMap<>(); if (CollectionUtils.isNotEmpty(viewFields)) { - viewFields.forEach(field -> { + String[] busiFlagArray = new String[] {"daxis", "locationXaxis", "locationYaxis"}; + Map flagMap = new HashMap<>(); + for (String s : busiFlagArray) { + flagMap.put(s, false); + } + for (ChartViewFieldDTO field : viewFields) { + flagMap.put(field.getBusiType(), true); String busiType = field.getBusiType(); List list = extFieldsMap.containsKey(busiType) ? extFieldsMap.get(busiType) : new ArrayList<>(); list.add(field); extFieldsMap.put(field.getBusiType(), list); - }); + } + if (flagMap.get("daxis") && (!flagMap.get("locationXaxis") || !flagMap.get("locationYaxis"))) { + viewFields = viewFields.stream().filter(field -> !StringUtils.equals("daxis", field.getBusiType())).collect(Collectors.toList()); + } } List xAxisBase = gson.fromJson(view.getXAxis(), tokenType);