Browse Source

CHART-21376 fix:大屏模板组合图新增类型 默认样式

zheng-1641779399395
shine 3 years ago
parent
commit
19bdeeacc3
  1. 91
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java
  2. 2
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java

91
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.ConditionAttr;
import com.fr.chart.chartglyph.DataSheet; import com.fr.chart.chartglyph.DataSheet;
import com.fr.config.predefined.ColorFillStyle; 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.PiePlot4VanChart;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; 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.map.VanChartMapPlot;
import com.fr.plugin.chart.type.GaugeStyle;
/** /**
* @author shine * @author shine
@ -21,7 +27,39 @@ import com.fr.plugin.chart.map.VanChartMapPlot;
*/ */
public class DefaultStyleHelper4Van { 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) { if (plot instanceof VanChartPlot) {
VanChartPlot vanChartPlot = (VanChartPlot) plot; VanChartPlot vanChartPlot = (VanChartPlot) plot;
@ -60,6 +98,9 @@ public class DefaultStyleHelper4Van {
} }
public static VanChartAxis dealAxisDefault(VanChartAxis axis) { public static VanChartAxis dealAxisDefault(VanChartAxis axis) {
if (!ChartEditContext.duchampMode()) {
return axis;
}
axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE);
axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL); axis.getTextAttr().setFRFont(DefaultStyleConstants.AXIS_LABEL);
axis.setAxisColor(DefaultStyleConstants.AXIS_LINE); axis.setAxisColor(DefaultStyleConstants.AXIS_LINE);
@ -84,4 +125,52 @@ public class DefaultStyleHelper4Van {
} }
return DefaultStyleConstants.BORDER_WIDTH; 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;
}
}
}
} }

2
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java

@ -260,7 +260,7 @@ public class VanChartCustomPlotSelectPane extends BasicBeanPane<Chart> {
CustomPlotType customPlotType = selectedPlotTypeList.get(i); CustomPlotType customPlotType = selectedPlotTypeList.get(i);
if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){ if (!CustomPlotFactory.customPlotContains(newCustomPlotList, customPlotType)){
VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType); VanChartPlot vanChartPlot = CustomPlotFactory.getCustomPlot(customPlotType);
DefaultStyleHelper4Van.dealVanPlot(vanChartPlot); DefaultStyleHelper4Van.dealVanPlot4Custom(vanChartPlot, customPlotType);
vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString()); vanChartPlot.setCustomType(CustomStyle.CUSTOM.toString());
//设置公共属性 //设置公共属性
setCommonAttr(vanChartPlot, customPlot); setCommonAttr(vanChartPlot, customPlot);

Loading…
Cancel
Save