diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataHelper.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataHelper.java new file mode 100644 index 0000000000..0ff5b275f4 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataHelper.java @@ -0,0 +1,35 @@ +package com.fr.design.mainframe.chart.gui.data; + +import com.fr.base.chart.chartdata.TopDefinitionProvider; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.chart.chartattr.Plot; +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.config.DefaultStyleHelper4Van; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2022/4/6 + */ +public class ChartDataHelper { + + /** + * 在update数据集分类的时候,需要联动update一下样式-坐标轴里面的分层样式设置,来自CHART-22873 + */ + public static void updateAxisCategoryStyles(ChartCollection chartCollection) { + TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition(); + int size = definition == null ? 1 : definition.getMoreCateSize() + 1; + + Plot plot = chartCollection.getSelectedChart().getPlot(); + if (plot instanceof VanChartAxisPlot) { + for (VanChartAxis axis : ((VanChartAxisPlot) plot).getXAxisList()) { + axis.clearCategoryStyles(); + for (int i = 0; i < size; i++) { + axis.addCategoryStyle(DefaultStyleHelper4Van.dealAxisCheckTheme(new VanChartAxisLabelStyle())); + } + } + } + } +} 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 54c3bd33d4..a9c6beda5e 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 @@ -13,6 +13,7 @@ import com.fr.design.formula.TinyFormulaPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; +import com.fr.design.mainframe.chart.gui.data.ChartDataHelper; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -193,7 +194,7 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor reportDefinition.clearMoreCate(); updateMoreCate(reportDefinition, plot); - collection.updateAxisCategoryStyles(); + ChartDataHelper.updateAxisCategoryStyles(collection); } } 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 4c809e64f3..ca5a988559 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 @@ -13,6 +13,7 @@ import com.fr.design.gui.icombobox.UIComboBox; 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.mainframe.chart.gui.data.ChartDataHelper; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.BorderFactory; @@ -246,7 +247,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD normal.clearMoreCate(); updateMoreCate(normal, plot); } - collection.updateAxisCategoryStyles(); + ChartDataHelper.updateAxisCategoryStyles(collection); } protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java index 8421492fa8..a6ce45a534 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -5,6 +5,7 @@ import com.fr.base.ChartPreStyleConfig; import com.fr.chart.base.AttrBorder; import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.ChartConstants; +import com.fr.chart.base.ChartThemeStyleProvider; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.DataSheet; @@ -14,6 +15,7 @@ import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.attr.axis.VanChartAlertValue; import com.fr.plugin.chart.attr.axis.VanChartAxis; +import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.base.AttrLabel; @@ -24,6 +26,9 @@ import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.vanchart.VanChart; +import java.util.ArrayList; +import java.util.List; + /** * @author shine * @version 10.0 @@ -82,7 +87,28 @@ public class DefaultStyleHelper4Van { } + private static void dealAxisCheckTheme(VanChartAxis axis) { + if (!ChartEditContext.supportTheme()) { + List chartThemeStyleProviders = new ArrayList<>(); + VanChartRectanglePlot.getAxisChartPreStyleProvider(axis, chartThemeStyleProviders); + for (ChartThemeStyleProvider themeStyleProvider : chartThemeStyleProviders) { + themeStyleProvider.setThemeCustom(); + } + } + } + + public static VanChartAxisLabelStyle dealAxisCheckTheme(VanChartAxisLabelStyle labelStyle) { + if (!ChartEditContext.supportTheme()) { + labelStyle.getTextAttr().setThemeCustom(); + } + return labelStyle; + } + + public static VanChartAxis dealAxisDefault(VanChartAxis axis) { + + dealAxisCheckTheme(axis); + if (!duchampMode()) { return axis; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java index 5deb498319..dde467226c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisStyleSettingPane.java @@ -13,6 +13,7 @@ import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.plugin.chart.attr.axis.VanChartAxisLabelStyle; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.axis.component.AxisLabelDisplayComboBox; @@ -125,6 +126,7 @@ public class VanChartAxisStyleSettingPane extends BasicBeanPane { private VanChartAxisLabelStyle getAxisLabelStyle(VanChartAxis axis) { VanChartAxisLabelStyle style = new VanChartAxisLabelStyle(); + DefaultStyleHelper4Van.dealAxisCheckTheme(style); style.setLabelDisplay(axis.getLabelDisplay()); style.setTextAttr(axis.getTextAttr()); style.setAutoLabelGap(axis.isAutoLabelGap()); @@ -663,6 +665,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { style = axis.getCategoryStyle(index); } else { style = new VanChartAxisLabelStyle(); + DefaultStyleHelper4Van.dealAxisCheckTheme(style); axis.addCategoryStyle(style); } return style;