From 35e7d2d23f9e4ab3353a9836d71b9a2b8c360775 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 22 Oct 2021 11:34:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?CHART-21391=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=20=E7=BB=84=E5=90=88=E5=9B=BE=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BB=84=E5=90=88?= =?UTF-8?q?=E5=9B=BE=20=E7=B1=BB=E5=9E=8B=E9=9D=A2=E6=9D=BF=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=87=BA=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/chart/ChartEditPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java index 70b7130f12..6b75dff693 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java @@ -22,9 +22,11 @@ import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.info.ChartInfoCollector; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.form.main.Form; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; +import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.vanchart.VanChart; import javax.swing.JPanel; @@ -334,7 +336,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare String chartID = chart.getID(); boolean currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(chartID); - return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex); + boolean duchampCustomChart = ChartEditContext.duchampMode() + && VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID.equals(chartID); + + return (currentPane != isDefaultPane) || (!currentPane && lastIndex != currentIndex) || duchampCustomChart; } return false; } From ba77f3016e1a04befe88a64bd8c42a7dbbdef960 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 22 Oct 2021 14:50:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?CHART-21357=20fix:=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=9D=90=E6=A0=87=E8=BD=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/config/DefaultStyleConstants.java | 89 +++++++++++++++++++ .../chart/config/DefaultStyleHelper4Van.java | 87 ++++++++++++++++++ .../VanChartCustomPlotSelectPane.java | 3 +- .../designer/style/axis/VanChartAxisPane.java | 7 +- .../VanChartAxisScrollPaneWithTypeSelect.java | 9 +- 5 files changed, 188 insertions(+), 7 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java new file mode 100644 index 0000000000..e529fc1d64 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java @@ -0,0 +1,89 @@ +package com.fr.van.chart.config; + +import com.fr.base.ChartPreStyleConfig; +import com.fr.chart.base.ChartBaseUtils; +import com.fr.chart.base.ChartConstants; +import com.fr.general.Background; +import com.fr.general.FRFont; +import com.fr.general.GeneralUtils; +import com.fr.stable.CodeUtils; +import com.fr.stable.Constants; + +import java.awt.Color; +import java.awt.Font; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/6/25 + */ +public class DefaultStyleConstants { + static final FRFont TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.BOLD, 14, new Color(241, 246, 255)); + static final FRFont LEGEND = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191)); + + static final FRFont AXIS_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191)); + static final FRFont AXIS_TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(200, 211, 228)); + static final Color AXIS_LINE = new Color(46, 75, 102); + static final Color GRID_LINE = new Color(30, 55, 78); + + static final FRFont DATA_SHEET = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191)); + static final Color DATA_SHEET_BORDER = new Color(46, 75, 102); + + static final Color BORDER = Color.BLACK; + static final int BORDER_WIDTH = Constants.LINE_NONE; + static final int SPECIAL_BORDER_WIDTH = Constants.LINE_THIN; + + static final FRFont PIE_CATEGORY_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 10, new Color(232, 232, 232)); + + static final Color GAUGE_PANE_BACK_COLOR = null; + static final Color GAUGE_HINGE = null; + static final Color GAUGE_PANE_BACK_COLOR_4_RING = new Color(72, 73, 79); + static final Color GAUGE_SLOT_BACKGROUND_COLOR = new Color(72, 73, 79); + private static final String FONT_NAME = ChartBaseUtils.getLocalDefaultFont("verdana"); + static final FRFont THERMOMETER_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.BOLD, 9, new Color(232, 232, 232));//试管仪表盘标签的默认样式 + static final FRFont THERMOMETER_AXIS_LABEL = FRFont.getInstance(FONT_NAME, Font.PLAIN, 8, new Color(159, 173, 191)); + static final FRFont RING_VALUE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, ChartConstants.AUTO_FONT_SIZE, new Color(232, 232, 232));//百分比圆环仪表盘值标签的默认样式 + static final FRFont POINTER_VALUE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, ChartConstants.AUTO_FONT_SIZE, new Color(232, 232, 232));//多指针仪表盘值标签的默认样式 + static final FRFont POINTER_CATE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, 10, new Color(232, 232, 232));//多指针仪表盘分类标签的默认样式 + + static final Color MAP_NULL_VALUE_COLOR = new Color(168, 168, 168); + static final Color MAP_BORDER = Color.BLACK; + static final Color MAP_LEGEND_BACK = Color.BLACK; + static final Color MAP_TITLE_BACK = Color.BLACK; + + static final Color DRILL_MAP_DRILL_TOOLS_BACK = Color.BLACK; + static final float DRILL_MAP_DRILL_TOOLS_BACK_OPACITY = 0.8f; + + //todo vancharts + private static final Color GANTT_OUT_LINE = GRID_LINE; + private static final FRFont GANTT_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 8, new Color(217, 217, 217)); + private static final Color GANTT_BORDER_LINE = new Color(30, 36, 58); + private static final Color GAUGE_TICK = new Color(39, 49, 71); + + static final Background BACK = null; + + static String COLORS = null; + + static { + ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); + try { + DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae"); + // 没有经典高亮, 用新特性 + if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { + DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u65b0\u7279\u6027"); + } + // 没有新特性, 用第一个配色 + if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { + if (config.names().hasNext()) { + + String name = GeneralUtils.objectToString(config.names().next()); + if (config.getPreStyle(name) != null) { + DefaultStyleConstants.COLORS = name; + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} 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 new file mode 100644 index 0000000000..b65e7eecbb --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java @@ -0,0 +1,87 @@ +package com.fr.van.chart.config; + +import com.fr.chart.base.AttrBorder; +import com.fr.chart.base.AttrFillStyle; +import com.fr.chart.base.ChartConstants; +import com.fr.chart.chartattr.Plot; +import com.fr.chart.chartglyph.ConditionAttr; +import com.fr.chart.chartglyph.DataSheet; +import com.fr.config.predefined.ColorFillStyle; +import com.fr.plugin.chart.PiePlot4VanChart; +import com.fr.plugin.chart.attr.axis.VanChartAxis; +import com.fr.plugin.chart.attr.plot.VanChartPlot; +import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; +import com.fr.plugin.chart.map.VanChartMapPlot; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/10/22 + * vanchart的专门写一个,因为主体代码 新增y轴 组合图新增图表都要用 + */ +public class DefaultStyleHelper4Van { + + public static void dealVanPlot(Plot plot) { + if (plot instanceof VanChartPlot) { + VanChartPlot vanChartPlot = (VanChartPlot) plot; + + ColorFillStyle colorFillStyle = new ColorFillStyle(); + colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); + colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS); + AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); + if (plotFillStyle == null) { + plotFillStyle = new AttrFillStyle(); + vanChartPlot.setPlotFillStyle(plotFillStyle); + } + plotFillStyle.setColorFillStyle(colorFillStyle); + + if (vanChartPlot.getLegend() != null) { + vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND); + } + + if (vanChartPlot instanceof VanChartRectanglePlot) { + VanChartRectanglePlot vanChartRectanglePlot = (VanChartRectanglePlot) vanChartPlot; + + for (VanChartAxis axis : vanChartRectanglePlot.getXAxisList()) { + dealAxisDefault(axis); + } + for (VanChartAxis axis : vanChartRectanglePlot.getYAxisList()) { + dealAxisDefault(axis); + } + } + + dealBorder(vanChartPlot); + + DataSheet dataSheet = vanChartPlot.getDataSheet(); + dataSheet.getTextAttr().setFRFont(DefaultStyleConstants.DATA_SHEET); + dataSheet.setBorderColor(DefaultStyleConstants.DATA_SHEET_BORDER); + } + + } + + public static VanChartAxis dealAxisDefault(VanChartAxis axis) { + axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); + axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); + axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); + axis.setMainGridColor(DefaultStyleConstants.GRID_LINE); + return axis; + } + + private static void dealBorder(VanChartPlot vanChartPlot) { + ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); + AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); + if (attrBorder != null) { + attrBorder.setBorderColor(DefaultStyleConstants.BORDER); + attrBorder.setBorderStyle(defaultBorderWidth(vanChartPlot)); + } + } + + private static int defaultBorderWidth(VanChartPlot vanChartPlot) { + //pie multipie treemap map drillmap heatmap + if (vanChartPlot instanceof PiePlot4VanChart + || vanChartPlot instanceof VanChartMapPlot) { + return DefaultStyleConstants.SPECIAL_BORDER_WIDTH; + } + return DefaultStyleConstants.BORDER_WIDTH; + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java index 8f7b9557d0..b5a8a13f9c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java @@ -6,13 +6,13 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; - import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.custom.CustomPlotFactory; import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.type.CustomPlotType; import com.fr.plugin.chart.custom.type.CustomStyle; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.custom.CustomPlotDesignerPaneFactory; import javax.swing.JOptionPane; @@ -260,6 +260,7 @@ public class VanChartCustomPlotSelectPane extends BasicBeanPane { CustomPlotType customPlotType = selectedPlotTypeList.get(i); if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){ VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType); + DefaultStyleHelper4Van.dealVanPlot(vanChartPlot); vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString()); //设置公共属性 setCommonAttr(vanChartPlot, customPlot); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java index 5c71317f20..e8379e78b4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisPane.java @@ -14,16 +14,17 @@ import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.vanchart.VanChart; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.axis.component.VanChartAxisButtonPane; import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.CardLayout; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.awt.BorderLayout; -import java.awt.CardLayout; /** * 样式-坐标轴界面 @@ -104,6 +105,7 @@ public class VanChartAxisPane extends BasicBeanPane { List xAxisList = editingPlot.getXAxisList(); VanChartAxis axis = editingPlot.createXAxis(name, VanChartConstants.AXIS_BOTTOM); xAxisList.add(axis); + DefaultStyleHelper4Van.dealAxisDefault(axis); VanChartXYAxisPaneInterface axisPane = initXAxisPane(axis); axisPane.populate(axis); @@ -119,6 +121,7 @@ public class VanChartAxisPane extends BasicBeanPane { List yAxisList = editingPlot.getYAxisList(); VanChartAxis axis = editingPlot.createYAxis(name, VanChartConstants.AXIS_LEFT); yAxisList.add(axis); + DefaultStyleHelper4Van.dealAxisDefault(axis); VanChartXYAxisPaneInterface axisPane = initYAxisPane(axis); axisPane.populate(axis); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java index ef042e0f2a..daa7ca3c95 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java @@ -1,15 +1,16 @@ package com.fr.van.chart.designer.style.axis; import com.fr.chart.chartattr.Axis; -import com.fr.design.i18n.Toolkit; import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.gui.frpane.UIComboBoxPane; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartTimeAxis; import com.fr.plugin.chart.attr.axis.VanChartValueAxis; import com.fr.plugin.chart.type.AxisType; +import com.fr.van.chart.config.DefaultStyleHelper4Van; import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.VanChartStylePane; @@ -83,9 +84,9 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll public void populate(VanChartAxis axis){ AxisType axisType = axis.getAxisType(); - textAxisPane.populateBean(new VanChartAxis(axis.getAxisName(), axis.getPosition())); - timeAxisPane.populateBean(new VanChartTimeAxis(axis.getAxisName(), axis.getPosition())); - valueAxisPane.populateBean(new VanChartValueAxis(axis.getAxisName(), axis.getPosition())); + textAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartAxis(axis.getAxisName(), axis.getPosition()))); + timeAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartTimeAxis(axis.getAxisName(), axis.getPosition()))); + valueAxisPane.populateBean(DefaultStyleHelper4Van.dealAxisDefault(new VanChartValueAxis(axis.getAxisName(), axis.getPosition()))); if(ComparatorUtils.equals(axisType, AxisType.AXIS_CATEGORY)){ textAxisPane.populateBean(axis); } else if(ComparatorUtils.equals(axisType, AxisType.AXIS_TIME)){ From 19bdeeacc366d9c8268ee9dff1ab80ddbd94b237 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 22 Oct 2021 15:24:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?CHART-21376=20fix:=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=BB=84=E5=90=88=E5=9B=BE=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=20=E9=BB=98=E8=AE=A4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/config/DefaultStyleHelper4Van.java | 91 ++++++++++++++++++- .../VanChartCustomPlotSelectPane.java | 2 +- 2 files changed, 91 insertions(+), 2 deletions(-) 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 b65e7eecbb..95eee394a4 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 @@ -7,11 +7,17 @@ import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.DataSheet; import com.fr.config.predefined.ColorFillStyle; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; +import com.fr.plugin.chart.base.AttrLabel; +import com.fr.plugin.chart.base.AttrLabelDetail; +import com.fr.plugin.chart.custom.type.CustomPlotType; +import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.map.VanChartMapPlot; +import com.fr.plugin.chart.type.GaugeStyle; /** * @author shine @@ -21,7 +27,39 @@ import com.fr.plugin.chart.map.VanChartMapPlot; */ public class DefaultStyleHelper4Van { - public static void dealVanPlot(Plot plot) { + public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { + dealVanPlotCommonAttr(plot); + switch (customPlotType) { + case PIE: + case DIFFERENT_PIE: + case SAME_PIE: + dealPie(plot); + break; + case SLOT: + case POINTER_360: + case POINTER_180: + case CUVETTE: + case RING: + dealGauge(plot); + break; + case COLUMN: + case LINE: + case AREA: + case BUBBLE: + case RADAR: + case STACK_RADAR: + case SCATTER: + default: + break; + } + + } + + + public static void dealVanPlotCommonAttr(Plot plot) { + if (!ChartEditContext.duchampMode()) { + return; + } if (plot instanceof VanChartPlot) { VanChartPlot vanChartPlot = (VanChartPlot) plot; @@ -60,6 +98,9 @@ public class DefaultStyleHelper4Van { } public static VanChartAxis dealAxisDefault(VanChartAxis axis) { + if (!ChartEditContext.duchampMode()) { + return axis; + } axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); @@ -84,4 +125,52 @@ public class DefaultStyleHelper4Van { } return DefaultStyleConstants.BORDER_WIDTH; } + + static void dealPie(Plot plot) { + if (plot instanceof PiePlot4VanChart) { + ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); + AttrLabel attrLabel = defaultAttr.getExisted(AttrLabel.class); + if (attrLabel == null) { + attrLabel = ((PiePlot4VanChart) plot).getDefaultAttrLabel(); + defaultAttr.addDataSeriesCondition(attrLabel); + } + attrLabel.getSecondLabelDetail().getTextAttr().setFRFont(DefaultStyleConstants.PIE_CATEGORY_LABEL); + } + } + + static void dealGauge(Plot param) { + if (!(param instanceof VanChartGaugePlot)) { + return; + } + VanChartGaugePlot plot = (VanChartGaugePlot) param; + plot.getGaugeDetailStyle().setPaneBackgroundColor(plot.getGaugeStyle() == GaugeStyle.RING ? DefaultStyleConstants.GAUGE_PANE_BACK_COLOR_4_RING : DefaultStyleConstants.GAUGE_PANE_BACK_COLOR); + plot.getGaugeDetailStyle().setSlotBackgroundColor(DefaultStyleConstants.GAUGE_SLOT_BACKGROUND_COLOR); + plot.getGaugeDetailStyle().setHingeColor(DefaultStyleConstants.GAUGE_HINGE); + + ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); + AttrLabel attrLabel = defaultAttr.getExisted(AttrLabel.class); + if (attrLabel != null) { + AttrLabelDetail detail = attrLabel.getAttrLabelDetail(); + AttrLabelDetail valueDetail = attrLabel.getGaugeValueLabelDetail(); + + switch (plot.getGaugeStyle()) { + case POINTER: + case POINTER_SEMI: + detail.getContent().getCategoryFormat().setEnable(false); + detail.getTextAttr().setFRFont(DefaultStyleConstants.POINTER_CATE_LABEL_FONT); + valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.POINTER_VALUE_LABEL_FONT); + break; + case RING: + case SLOT: + valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.RING_VALUE_LABEL_FONT); + break; + case THERMOMETER: + detail.getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_LABEL_FONT); + valueDetail.getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_LABEL_FONT); + plot.getGaugeAxis().getTextAttr().setFRFont(DefaultStyleConstants.THERMOMETER_AXIS_LABEL); + break; + } + + } + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java index b5a8a13f9c..99498c58a8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java @@ -260,7 +260,7 @@ public class VanChartCustomPlotSelectPane extends BasicBeanPane { CustomPlotType customPlotType = selectedPlotTypeList.get(i); if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){ VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType); - DefaultStyleHelper4Van.dealVanPlot(vanChartPlot); + DefaultStyleHelper4Van.dealVanPlot4Custom(vanChartPlot, customPlotType); vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString()); //设置公共属性 setCommonAttr(vanChartPlot, customPlot); From 283fddcfb24cc7d36c6733bf3a80a2b2bd9844b2 Mon Sep 17 00:00:00 2001 From: shine Date: Fri, 22 Oct 2021 17:02:47 +0800 Subject: [PATCH 4/4] for duchamp mode --- .../chart/config/DefaultStyleHelper4Van.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) 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 95eee394a4..5f7e318a71 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 @@ -23,11 +23,14 @@ import com.fr.plugin.chart.type.GaugeStyle; * @author shine * @version 10.0 * Created by shine on 2021/10/22 - * vanchart的专门写一个,因为主体代码 新增y轴 组合图新增图表都要用 + * vanchart的抽出来,因为主体代码 新增y轴 组合图新增图表都要用 */ public class DefaultStyleHelper4Van { public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { + if (!ChartEditContext.duchampMode()) { + return; + } dealVanPlotCommonAttr(plot); switch (customPlotType) { case PIE: @@ -55,8 +58,18 @@ public class DefaultStyleHelper4Van { } + public static VanChartAxis dealAxisDefault(VanChartAxis axis) { + if (!ChartEditContext.duchampMode()) { + return axis; + } + axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); + axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); + axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); + axis.setMainGridColor(DefaultStyleConstants.GRID_LINE); + return axis; + } - public static void dealVanPlotCommonAttr(Plot plot) { + static void dealVanPlotCommonAttr(Plot plot) { if (!ChartEditContext.duchampMode()) { return; } @@ -97,17 +110,6 @@ public class DefaultStyleHelper4Van { } - public static VanChartAxis dealAxisDefault(VanChartAxis axis) { - if (!ChartEditContext.duchampMode()) { - return axis; - } - axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); - axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); - axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); - axis.setMainGridColor(DefaultStyleConstants.GRID_LINE); - return axis; - } - private static void dealBorder(VanChartPlot vanChartPlot) { ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class);