Merge pull request #11300 from dataease/pr@dev-v2@fix_group_bar_drill

fix(图表): 修复分组柱状图下钻分组信息丢失 #10875
This commit is contained in:
wisonic-s 2024-07-31 19:51:47 +08:00 committed by GitHub
commit 61a6eeab68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View File

@ -6,10 +6,7 @@ import lombok.Getter;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Component
@ -69,7 +66,8 @@ public class GroupBarHandler extends BarHandler {
var xAxis = formatResult.getAxisMap().get(ChartAxis.xAxis);
var xAxisExt = formatResult.getAxisMap().get(ChartAxis.xAxisExt);
var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis);
var xAxisBase = xAxis.subList(0, xAxis.size() - xAxisExt.size());
var drillAxis = xAxis.stream().filter(axis -> FieldSource.DRILL == axis.getSource()).toList();
var xAxisBase = xAxis.subList(0, xAxis.size() - xAxisExt.size() - drillAxis.size());
return ChartDataBuild.transBaseGroupDataAntV(xAxisBase, xAxis, xAxisExt, yAxis, view, data, isDrill);
}
}

View File

@ -288,7 +288,7 @@ public class ChartDataManage {
if (i == drillRequestList.size() - 1) {
ChartViewFieldDTO nextDrillField = drill.get(i + 1);
if (!fields.contains(nextDrillField.getId())) {
viewField.setSource(FieldSource.DRILL);
nextDrillField.setSource(FieldSource.DRILL);
nextDrillField.setSort(getDrillSort(xAxis, drill.get(0)));
xAxis.add(nextDrillField);
dillAxis.add(nextDrillField);