From fb9ace4a25c57a2b47239b674f448e6b2d615857 Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Wed, 25 Sep 2024 18:49:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=90=8C=E7=8E=AF=E6=AF=94=E6=8E=92=E5=BA=8F=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=E5=9B=BE=E8=A1=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98=20#12407?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/chart/charts/impl/YoyChartHandler.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java index a53999a8a3..519ba6afc8 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/YoyChartHandler.java @@ -120,11 +120,11 @@ public class YoyChartHandler extends DefaultChartHandler { expandedResult.setQuerySql(originSql); } // 同环比数据排序 - expandedResult.setOriginData(sortData(view, expandedResult.getOriginData())); + expandedResult.setOriginData(sortData(view, expandedResult.getOriginData(),formatResult)); return expandedResult; } - public static List sortData(ChartViewDTO view, List data) { + public static List sortData(ChartViewDTO view, List data, AxisFormatResult formatResult) { // 维度排序 List xAxisSortList = view.getXAxis().stream().filter(x -> !StringUtils.equalsIgnoreCase("none", x.getSort())).toList(); // 指标排序 @@ -135,11 +135,9 @@ public class YoyChartHandler extends DefaultChartHandler { ChartViewFieldDTO firstYAxis = yAxisSortList.getFirst(); boolean asc = firstYAxis.getSort().equalsIgnoreCase("asc"); // 维度指标 - List allAxisList = Stream.of( - view.getXAxis(), - view.getXAxisExt(), - view.getYAxis() - ).flatMap(List::stream).toList(); + List allAxisList = new ArrayList<>(); + allAxisList.addAll(formatResult.getAxisMap().get(ChartAxis.xAxis)); + allAxisList.addAll(formatResult.getAxisMap().get(ChartAxis.yAxis)); int index = findIndex(allAxisList, firstYAxis.getId()); return sortData(data, asc, index); }