|
|
|
@ -1,11 +1,14 @@
|
|
|
|
|
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; |
|
|
|
|
import com.fr.chart.chartattr.Plot; |
|
|
|
|
import com.fr.chart.chartglyph.ConditionAttr; |
|
|
|
|
import com.fr.chart.chartglyph.DataSheet; |
|
|
|
|
import com.fr.chartx.attr.ChartProvider; |
|
|
|
|
import com.fr.config.predefined.ColorFillStyle; |
|
|
|
|
import com.fr.design.mainframe.chart.mode.ChartEditContext; |
|
|
|
|
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.map.VanChartMapPlot; |
|
|
|
|
import com.fr.plugin.chart.type.GaugeStyle; |
|
|
|
|
import com.fr.plugin.chart.vanchart.VanChart; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author shine |
|
|
|
@ -28,8 +32,27 @@ 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 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) { |
|
|
|
|
if (!ChartEditContext.duchampMode()) { |
|
|
|
|
if (!duchampMode()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
dealVanPlotCommonAttr(plot); |
|
|
|
@ -60,7 +83,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 +94,20 @@ 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); |
|
|
|
|
} |
|
|
|
|
plotFillStyle.setColorFillStyle(colorFillStyle); |
|
|
|
|
dealChartColor(vanChartPlot); |
|
|
|
|
|
|
|
|
|
if (vanChartPlot.getLegend() != null) { |
|
|
|
|
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) { |
|
|
|
|
ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); |
|
|
|
|
AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); |
|
|
|
|