From 0248a72bd3b406c26941de303b31623156a0ae42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 11 Feb 2022 21:35:50 +0800 Subject: [PATCH] =?UTF-8?q?CHART-22767&CHART-22876&CHART-22873&CHART-22861?= =?UTF-8?q?&CHART-22863&CHART-22797&CHART-22768=20=E8=8B=A5=E5=B9=B2bug?= =?UTF-8?q?=E4=B8=80=E8=B5=B7=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChangeConfigPane.java | 3 ++- ...goryPlotMoreCateReportDataContentPane.java | 6 ++--- ...egoryPlotMoreCateTableDataContentPane.java | 3 ++- .../style/axis/VanChartAxisPaneHelper.java | 26 +++++++++++++++++++ .../style/axis/VanChartBaseAxisPane.java | 16 +++++++++++- 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java index ebc3ab5b3..043aa3df1 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChangeConfigPane.java @@ -246,7 +246,8 @@ public class ChangeConfigPane extends BasicBeanPane { result = Utils.objectToString(switchTitle); } } else { - result = Toolkit.i18nText("Fine-Design_Chart_Chart") + (chartIndex + 1); + result = collection.getChartName(chartIndex); + chart.setSwitchTitle(result); } TinyFormulaPane title = new TinyFormulaPane(); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java index 93d189c69..057492b0f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java @@ -7,7 +7,6 @@ import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalReportDataDefinition; -import com.fr.decision.base.util.UUIDUtil; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.formula.TinyFormulaPane; @@ -16,6 +15,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.style.axis.VanChartAxisPaneHelper; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -28,7 +28,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; -import java.util.Map; /** @@ -192,11 +191,10 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor Plot plot = collection.getSelectedChart().getPlot(); if (definition instanceof NormalReportDataDefinition) { NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; - reportDefinition.clearMoreCate(); updateMoreCate(reportDefinition, plot); - } + VanChartAxisPaneHelper.updateAxisCategoryStyles(collection); } protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java index 572c28edd..10ce5fcec 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java @@ -14,6 +14,7 @@ import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.van.chart.designer.style.axis.VanChartAxisPaneHelper; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -246,6 +247,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD normal.clearMoreCate(); updateMoreCate(normal, plot); } + VanChartAxisPaneHelper.updateAxisCategoryStyles(collection); } protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { @@ -256,5 +258,4 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD } } } - } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java index 770043af9..9c327b2b2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPaneHelper.java @@ -1,9 +1,15 @@ package com.fr.van.chart.designer.style.axis; +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithThemeStyle; import com.fr.design.mainframe.chart.mode.ChartEditContext; +import com.fr.plugin.chart.attr.axis.VanChartAxis; +import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle; +import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.JPanel; @@ -27,4 +33,24 @@ public class VanChartAxisPaneHelper { } }; } + + /** + * 在update数据集分类的时候,需要联动update一下样式-坐标轴里面的分层样式设置,来自CHART-22873 + * + * @param collection + */ + public static void updateAxisCategoryStyles(ChartCollection collection) { + TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); + int size = definition == null ? 1 : definition.getMoreCateSize() + 1; + + Plot plot = collection.getSelectedChart().getPlot(); + if (plot instanceof VanChartAxisPlot) { + for(VanChartAxis axis : ((VanChartAxisPlot) plot).getXAxisList()){ + axis.clearCategoryStyles(); + for (int i = 0; i < size; i++) { + axis.addCategoryStyle(new VanChartAxisLabelStyle()); + } + } + } + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index 1023ecde8..a6f667100 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java @@ -46,6 +46,7 @@ import javax.swing.event.ChangeListener; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -264,7 +265,20 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { private JPanel createLabelContentPane() { labelContentPane = new JPanel(new BorderLayout()); showLogicPane = new JPanel(new BorderLayout()); - labelStylePane = new JPanel(new CardLayout()); + labelStylePane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + switch (showLogic.getSelectedIndex()) { + case 0: + return wholeDisplayLabelPanel.getPreferredSize(); + case 1: + return categoryStylePane.getPreferredSize(); + case -1: + default: + return super.getPreferredSize(); + } + } + }; labelStylePane.add(wholeDisplayLabelPanel, WHOLE_DISPLAY); labelStylePane.add(createCategoryStylePane(), LAYER_DISPLAY); showLogicPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Show_Logic"), showLogic), BorderLayout.NORTH);