From b927d0263d42229b111ed6915420701f7a8f91a5 Mon Sep 17 00:00:00 2001 From: shine Date: Wed, 8 Dec 2021 17:08:57 +0800 Subject: [PATCH] =?UTF-8?q?CHART-22213=20fix:=E6=96=B0=E5=A2=9E=E8=AD=A6?= =?UTF-8?q?=E6=88=92=E7=BA=BF=20=E9=BB=98=E8=AE=A4=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E6=98=AF9px12px=20=E4=B8=8D=E6=98=AF9px?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/config/DefaultStyleConstants.java | 26 +++++------ .../chart/config/DefaultStyleHelper4Van.java | 45 ++++++++++++++----- 2 files changed, 43 insertions(+), 28 deletions(-) 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 index 6d0de41cee..4cbba62906 100644 --- 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 @@ -18,35 +18,35 @@ import java.awt.Font; * 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 TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.BOLD, 19, new Color(241, 246, 255)); + static final FRFont LEGEND = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, 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 FRFont AXIS_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(159, 173, 191)); + static final FRFont AXIS_TITLE = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, 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 ALERT_FONT = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(255, 0, 0)); + static final FRFont ALERT_FONT = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, new Color(255, 0, 0)); - static final FRFont DATA_SHEET = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 9, new Color(159, 173, 191)); + static final FRFont DATA_SHEET = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 12, 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 FRFont PIE_CATEGORY_LABEL = FRFont.getInstance(ChartBaseUtils.getLocalDefaultFont("Microsoft YaHei"), Font.PLAIN, 13, 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 THERMOMETER_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.BOLD, 12, new Color(232, 232, 232));//试管仪表盘标签的默认样式 + static final FRFont THERMOMETER_AXIS_LABEL = FRFont.getInstance(FONT_NAME, Font.PLAIN, 11, 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 FRFont POINTER_CATE_LABEL_FONT = FRFont.getInstance(FONT_NAME, Font.PLAIN, 13, new Color(232, 232, 232));//多指针仪表盘分类标签的默认样式 static final Color MAP_NULL_VALUE_COLOR = new Color(168, 168, 168); static final Color MAP_BORDER = Color.BLACK; @@ -56,12 +56,6 @@ public class DefaultStyleConstants { 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; 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 d6fc30bd5d..31694433ff 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 @@ -1,5 +1,7 @@ package com.fr.van.chart.config; +import com.fr.base.ChartColorMatching; +import com.fr.base.ChartPreStyleConfig; import com.fr.chart.base.AttrBorder; import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.ChartConstants; @@ -28,8 +30,17 @@ import com.fr.plugin.chart.type.GaugeStyle; */ public class DefaultStyleHelper4Van { + private static boolean duchampMode() { + try { + return ChartEditContext.duchampMode(); + } catch (Throwable e) { + //tomcat预览 默认数据的图表 + return true; + } + } + public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { - if (!ChartEditContext.duchampMode()) { + if (!duchampMode()) { return; } dealVanPlotCommonAttr(plot); @@ -60,7 +71,7 @@ public class DefaultStyleHelper4Van { } public static VanChartAxis dealAxisDefault(VanChartAxis axis) { - if (!ChartEditContext.duchampMode()) { + if (!duchampMode()) { return axis; } axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); @@ -71,28 +82,38 @@ public class DefaultStyleHelper4Van { } public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) { - if (!ChartEditContext.duchampMode()) { + if (!duchampMode()) { return; } vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT); } static void dealVanPlotCommonAttr(Plot plot) { - if (!ChartEditContext.duchampMode()) { + if (!duchampMode()) { return; } 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); + ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance(); + Object preStyle = manager.getPreStyle(DefaultStyleConstants.COLORS); + if (preStyle instanceof ChartColorMatching) { + ColorFillStyle colorFillStyle = new ColorFillStyle(); + //default是默认的意思,为服务器默认配色方案 + //acc为多个颜色组合 + //gradient为渐变颜色 + colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC); + colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS); + colorFillStyle.setColorList(((ChartColorMatching) preStyle).getColorList()); + + AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle(); + if (plotFillStyle == null) { + plotFillStyle = new AttrFillStyle(); + vanChartPlot.setPlotFillStyle(plotFillStyle); + } + plotFillStyle.setColorFillStyle(colorFillStyle); } - plotFillStyle.setColorFillStyle(colorFillStyle); + if (vanChartPlot.getLegend() != null) { vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND);