|
|
@ -1,11 +1,14 @@ |
|
|
|
package com.fr.van.chart.config; |
|
|
|
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.AttrBorder; |
|
|
|
import com.fr.chart.base.AttrFillStyle; |
|
|
|
import com.fr.chart.base.AttrFillStyle; |
|
|
|
import com.fr.chart.base.ChartConstants; |
|
|
|
import com.fr.chart.base.ChartConstants; |
|
|
|
import com.fr.chart.chartattr.Plot; |
|
|
|
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.chartx.attr.ChartProvider; |
|
|
|
import com.fr.config.predefined.ColorFillStyle; |
|
|
|
import com.fr.config.predefined.ColorFillStyle; |
|
|
|
import com.fr.design.mainframe.chart.mode.ChartEditContext; |
|
|
|
import com.fr.design.mainframe.chart.mode.ChartEditContext; |
|
|
|
import com.fr.plugin.chart.PiePlot4VanChart; |
|
|
|
import com.fr.plugin.chart.PiePlot4VanChart; |
|
|
@ -19,6 +22,7 @@ import com.fr.plugin.chart.custom.type.CustomPlotType; |
|
|
|
import com.fr.plugin.chart.gauge.VanChartGaugePlot; |
|
|
|
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; |
|
|
|
import com.fr.plugin.chart.type.GaugeStyle; |
|
|
|
|
|
|
|
import com.fr.plugin.chart.vanchart.VanChart; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author shine |
|
|
|
* @author shine |
|
|
@ -28,8 +32,27 @@ import com.fr.plugin.chart.type.GaugeStyle; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class DefaultStyleHelper4Van { |
|
|
|
public class DefaultStyleHelper4Van { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean duchampMode() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
return ChartEditContext.duchampMode(); |
|
|
|
|
|
|
|
} catch (Throwable e) { |
|
|
|
|
|
|
|
//tomcat预览 默认数据的图表
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void checkChartDefaultStyle4Duchamp(ChartProvider chartProvider) { |
|
|
|
|
|
|
|
if (!ChartEditContext.supportTheme() && chartProvider instanceof VanChart) { |
|
|
|
|
|
|
|
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
|
|
|
|
|
|
|
|
((VanChart) chartProvider).setThemeCustom(); |
|
|
|
|
|
|
|
dealChartColor((VanChart) chartProvider); |
|
|
|
|
|
|
|
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
|
|
|
|
|
|
|
|
// ((VanChart) chart4Update).setAutoThemeCustom();
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { |
|
|
|
public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { |
|
|
|
if (!ChartEditContext.duchampMode()) { |
|
|
|
if (!duchampMode()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
dealVanPlotCommonAttr(plot); |
|
|
|
dealVanPlotCommonAttr(plot); |
|
|
@ -60,7 +83,7 @@ public class DefaultStyleHelper4Van { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static VanChartAxis dealAxisDefault(VanChartAxis axis) { |
|
|
|
public static VanChartAxis dealAxisDefault(VanChartAxis axis) { |
|
|
|
if (!ChartEditContext.duchampMode()) { |
|
|
|
if (!duchampMode()) { |
|
|
|
return axis; |
|
|
|
return axis; |
|
|
|
} |
|
|
|
} |
|
|
|
axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); |
|
|
|
axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); |
|
|
@ -71,28 +94,20 @@ public class DefaultStyleHelper4Van { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) { |
|
|
|
public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) { |
|
|
|
if (!ChartEditContext.duchampMode()) { |
|
|
|
if (!duchampMode()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT); |
|
|
|
vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void dealVanPlotCommonAttr(Plot plot) { |
|
|
|
static void dealVanPlotCommonAttr(Plot plot) { |
|
|
|
if (!ChartEditContext.duchampMode()) { |
|
|
|
if (!duchampMode()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (plot instanceof VanChartPlot) { |
|
|
|
if (plot instanceof VanChartPlot) { |
|
|
|
VanChartPlot vanChartPlot = (VanChartPlot) plot; |
|
|
|
VanChartPlot vanChartPlot = (VanChartPlot) plot; |
|
|
|
|
|
|
|
|
|
|
|
ColorFillStyle colorFillStyle = new ColorFillStyle(); |
|
|
|
dealChartColor(vanChartPlot); |
|
|
|
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) { |
|
|
|
if (vanChartPlot.getLegend() != null) { |
|
|
|
vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND); |
|
|
|
vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND); |
|
|
@ -118,6 +133,31 @@ public class DefaultStyleHelper4Van { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void dealChartColor(VanChart vanChart) { |
|
|
|
|
|
|
|
dealChartColor(vanChart.getPlot()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void dealChartColor(VanChartPlot vanChartPlot) { |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void dealBorder(VanChartPlot vanChartPlot) { |
|
|
|
private static void dealBorder(VanChartPlot vanChartPlot) { |
|
|
|
ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); |
|
|
|
ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); |
|
|
|
AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); |
|
|
|
AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); |
|
|
|