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 b65e7eecb..95eee394a 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 b5a8a13f9..99498c58a 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);