Merge pull request #13183 from dataease/pr@dev-v2@fix_drill_sort

fix(图表): 修复堆叠柱状图下钻字段排序不生效
This commit is contained in:
wisonic-s 2024-11-06 18:44:11 +08:00 committed by GitHub
commit ef62656bcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -52,10 +52,10 @@ public class StackBarHandler extends BarHandler {
if (ObjectUtils.isNotEmpty(extStack) && if (ObjectUtils.isNotEmpty(extStack) &&
Objects.equals(drillFields.get(0).getId(), extStack.get(0).getId())) { Objects.equals(drillFields.get(0).getId(), extStack.get(0).getId())) {
fieldsToFilter.addAll(view.getXAxis()); fieldsToFilter.addAll(view.getXAxis());
groupStackDrill(noDrillFieldAxis, noDrillFilterList, fieldsToFilter, drillFields, drillRequestList);
formatResult.getAxisMap().put(ChartAxis.xAxis, noDrillFieldAxis);
result.setFilterList(noDrillFilterList);
} }
groupStackDrill(noDrillFieldAxis, noDrillFilterList, fieldsToFilter, drillFields, drillRequestList);
formatResult.getAxisMap().put(ChartAxis.xAxis, noDrillFieldAxis);
result.setFilterList(noDrillFilterList);
} }
return (T) result; return (T) result;
} }

View File

@ -316,6 +316,11 @@ public class ChartDataManage {
dillAxis.add(nextDrillField); dillAxis.add(nextDrillField);
fields.add(nextDrillField.getId()); fields.add(nextDrillField.getId());
} else { } else {
Optional<ChartViewFieldDTO> axis = xAxis.stream().filter(x -> Objects.equals(x.getId(), nextDrillField.getId())).findFirst();
axis.ifPresent(field -> {
field.setSort(nextDrillField.getSort());
field.setCustomSort(nextDrillField.getCustomSort());
});
dillAxis.add(nextDrillField); dillAxis.add(nextDrillField);
} }
} }