Browse Source

提交工程

master
forwardyy 3 years ago
parent
commit
f52a2059d7
  1. 129
      build.gradle
  2. 13
      encrypt.xml
  3. 29
      plugin.xml
  4. 18
      src/main/java/com/fr/plugin/sqy/surface/FuncRecorder.java
  5. 12
      src/main/java/com/fr/plugin/sqy/surface/PluginConstants.java
  6. 331
      src/main/java/com/fr/plugin/sqy/surface/chart/Chart.java
  7. 100
      src/main/java/com/fr/plugin/sqy/surface/chart/ChartDataConfig.java
  8. 16
      src/main/java/com/fr/plugin/sqy/surface/chart/ChartType.java
  9. 131
      src/main/java/com/fr/plugin/sqy/surface/config/AxisConfig.java
  10. 9
      src/main/java/com/fr/plugin/sqy/surface/config/ConfigProvider.java
  11. 83
      src/main/java/com/fr/plugin/sqy/surface/config/LabelConfig.java
  12. 70
      src/main/java/com/fr/plugin/sqy/surface/config/LineStyleConfig.java
  13. 45
      src/main/java/com/fr/plugin/sqy/surface/config/ShowConfig.java
  14. 182
      src/main/java/com/fr/plugin/sqy/surface/option/Axis3D.java
  15. 48
      src/main/java/com/fr/plugin/sqy/surface/option/AxisLine.java
  16. 31
      src/main/java/com/fr/plugin/sqy/surface/option/AxisTick.java
  17. 107
      src/main/java/com/fr/plugin/sqy/surface/option/ChartOption.java
  18. 26
      src/main/java/com/fr/plugin/sqy/surface/option/Grid3D.java
  19. 62
      src/main/java/com/fr/plugin/sqy/surface/option/LabelStyle.java
  20. 65
      src/main/java/com/fr/plugin/sqy/surface/option/LineStyle.java
  21. 69
      src/main/java/com/fr/plugin/sqy/surface/option/Series.java
  22. 48
      src/main/java/com/fr/plugin/sqy/surface/option/SplitLine.java
  23. 415
      src/main/java/com/fr/plugin/sqy/surface/option/SurfaceChartOptionBuilder.java
  24. 16
      src/main/java/com/fr/plugin/sqy/surface/option/ToolTip.java
  25. 146
      src/main/java/com/fr/plugin/sqy/surface/option/VisualMap.java
  26. 36
      src/main/java/com/fr/plugin/sqy/surface/option/Wireframe.java
  27. 16
      src/main/java/com/fr/plugin/sqy/surface/option/modle/ChartOptionDirector.java
  28. 14
      src/main/java/com/fr/plugin/sqy/surface/option/modle/ChartOptionProvide.java
  29. 7
      src/main/java/com/fr/plugin/sqy/surface/option/modle/OptionProvider.java
  30. 67
      src/main/java/com/fr/plugin/sqy/surface/pane/ReportDataPane.java
  31. 31
      src/main/java/com/fr/plugin/sqy/surface/pane/StylePane.java
  32. 66
      src/main/java/com/fr/plugin/sqy/surface/pane/TableDataPane.java
  33. 49
      src/main/java/com/fr/plugin/sqy/surface/pane/TypePane.java
  34. 230
      src/main/java/com/fr/plugin/sqy/surface/pane/style/Axis3DXPane.java
  35. 230
      src/main/java/com/fr/plugin/sqy/surface/pane/style/Axis3DYPane.java
  36. 229
      src/main/java/com/fr/plugin/sqy/surface/pane/style/Axis3DZPane.java
  37. 116
      src/main/java/com/fr/plugin/sqy/surface/pane/style/VisualPane.java
  38. 13
      src/main/java/com/fr/plugin/sqy/surface/provider/ChartProvider.java
  39. 52
      src/main/java/com/fr/plugin/sqy/surface/provider/ChartUIProvider.java
  40. 33
      src/main/java/com/fr/plugin/sqy/surface/util/CreatePaneUtils.java
  41. 17
      src/main/java/com/fr/plugin/sqy/surface/util/PluginStringUtils.java
  42. 18
      src/main/java/com/fr/plugin/sqy/surface/zenum/AxisNameLocationEnum.java
  43. 39
      src/main/java/com/fr/plugin/sqy/surface/zenum/AxisTypeEnum.java
  44. 39
      src/main/java/com/fr/plugin/sqy/surface/zenum/LineTypeEnum.java
  45. 0
      src/main/resources/com/fr/plugin/sqy/surface/css/index.css
  46. BIN
      src/main/resources/com/fr/plugin/sqy/surface/img/face.png
  47. BIN
      src/main/resources/com/fr/plugin/sqy/surface/img/icon.png
  48. BIN
      src/main/resources/com/fr/plugin/sqy/surface/img/type1.png
  49. 55833
      src/main/resources/com/fr/plugin/sqy/surface/js/echarts-gl.js
  50. 81523
      src/main/resources/com/fr/plugin/sqy/surface/js/echarts.js
  51. 65
      src/main/resources/com/fr/plugin/sqy/surface/js/index.js

129
build.gradle

@ -0,0 +1,129 @@
apply plugin: 'java'
[compileJava,compileTestJava]*.options*.encoding = 'UTF-8'
ext {
/**
* jar的路径
* 1.jar需要打包到zip中,lib根目录下
* 2.jar仅仅是编译时需要lib下子目录下即可
*/
libPath = "$projectDir/../webroot/WEB-INF/lib"
/**
* class进行加密保护
*/
guard = true
def pluginInfo = getPluginInfo()
pluginPre = "fine-plugin"
pluginName = pluginInfo.id
pluginVersion = pluginInfo.version
outputPath = "$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0/classes"
outputXmlPath = "$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0"
}
group = 'com.fr.plugin'
version = '10.0'
sourceCompatibility = '8'
sourceSets {
main {
java.outputDir = file(outputPath)
output.resourcesDir = file(outputPath)
}
}
ant.importBuild("encrypt.xml")
//ant变量
ant.projectDir = projectDir
ant.references["compile.classpath"] = ant.path {
fileset(dir: libPath, includes: '**/*.jar')
fileset(dir: ".",includes:"**/*.jar" )
}
classes.dependsOn('clean')
task copyFiles(type: Copy,dependsOn: 'classes'){
from outputPath
into "$projectDir/classes"
}
task copyXmlFiles(type: Copy){
from "$projectDir/plugin.xml"
into file("$outputXmlPath")
}
task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){
from "$projectDir/classes"
into "$projectDir/transform-classes"
include "**/*.*"
}
jar.dependsOn("preJar")
classes.dependsOn("copyXmlFiles")
task makeJar(type: Jar,dependsOn: preJar){
from fileTree(dir: "$projectDir/transform-classes")
baseName pluginPre
appendix pluginName
version pluginVersion
destinationDir = file("$buildDir/libs")
doLast(){
delete file("$projectDir/classes")
delete file("$projectDir/transform-classes")
}
}
task copyFile(type: Copy,dependsOn: ["makeJar"]){
from "$buildDir/libs"
from("$projectDir/lib") {
include "*.jar"
}
from "$projectDir/plugin.xml"
into file("$buildDir/temp/plugin")
}
task zip(type:Zip,dependsOn:["copyFile"]){
from "$buildDir/temp/plugin"
destinationDir file("$buildDir/install")
baseName pluginPre
appendix pluginName
version pluginVersion
}
//build时包含哪些文件,
processResources {
// exclude everything
// *.css没效果
// exclude '**/*.css'
// except this file
// include 'xx.xml'
}
/*读取plugin.xml中的version*/
def getPluginInfo(){
def xmlFile = file("plugin.xml")
if (!xmlFile.exists()) {
return ["id":"none", "version":"1.0.0"]
}
def plugin = new XmlParser().parse(xmlFile)
def version = plugin.version[0].text()
def id = plugin.id[0].text()
return ["id":id,"version":version]
}
repositories {
mavenLocal()
maven {
url = uri('http://mvn.finedevelop.com/repository/maven-public/')
}
}
dependencies {
//使jar
implementation fileTree(dir: 'lib', include: ['**/*.jar'])
implementation fileTree(dir: libPath, include: ['**/*.jar'])
}

13
encrypt.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<target name="compile_encrypt_javas" depends="copyFiles">
<echo message="加密文件"/>
<echo message="${projectDir}"/>
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask">
<classpath refid="compile.classpath"/>
</taskdef>
<pretreatment baseDir="${projectDir}"/>
</target>
<target name="compile_plain_javas" depends="copyFiles">
</target>
</project>

29
plugin.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.sqy.surface</id>
<name><![CDATA[ 3d曲面图 ]]></name>
<active>yes</active>
<version>1.1.2</version>
<env-version>10.0</env-version>
<vendor>yy</vendor>
<jartime>2021-05-26</jartime>
<description><![CDATA[ 3d曲面图 ]]></description>
<change-notes>
<![CDATA[2022-03-15 初始化工程
<br>2022-03-22 完成初版功能开发
<br>2022-03-23 添加js超级链接功能
<br>2022-03-30 添加坐标轴格式化
]]>
</change-notes>
<main-package>com.fr.plugin.sqy</main-package>
<!--功能点注册,这个类不能去掉-->
<function-recorder class="com.fr.plugin.sqy.surface.FuncRecorder"/>
<extra-chart>
<IndependentChartProvider class="com.fr.plugin.sqy.surface.provider.ChartProvider" plotID="SQY_CHART_SURFACE"/>
</extra-chart>
<extra-chart-designer>
<IndependentChartUIProvider class="com.fr.plugin.sqy.surface.provider.ChartUIProvider" plotID="SQY_CHART_SURFACE"/>
</extra-chart-designer>
</plugin>

18
src/main/java/com/fr/plugin/sqy/surface/FuncRecorder.java

@ -0,0 +1,18 @@
package com.fr.plugin.sqy.surface;
import com.fr.plugin.context.PluginContexts;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.stable.fun.Authorize;
//功能点注册
@FunctionRecorder
@Authorize(callSignKey = PluginConstants.PLUGIN_ID)
public class FuncRecorder {
@ExecuteFunctionRecord
public static boolean execute(){
return PluginContexts.currentContext().isAvailable();//付费
}
}

12
src/main/java/com/fr/plugin/sqy/surface/PluginConstants.java

@ -0,0 +1,12 @@
package com.fr.plugin.sqy.surface;
public class PluginConstants {
public static final String PLUGIN_ID = "com.fr.plugin.sqy.surface";
public static final String PLOT_ID = "SQY_CHART_SURFACE";
public static final String CHART_NAME = "\u66f2\u9762\u56fe";
}

331
src/main/java/com/fr/plugin/sqy/surface/chart/Chart.java

@ -0,0 +1,331 @@
package com.fr.plugin.sqy.surface.chart;
import com.fanruan.api.json.JSONKit;
import com.fr.config.predefined.ColorFillStyle;
import com.fr.extended.chart.AbstractChart;
import com.fr.extended.chart.HyperLinkPara;
import com.fr.extended.chart.StringFormula;
import com.fr.js.JavaScript;
import com.fr.js.NameJavaScript;
import com.fr.js.NameJavaScriptGroup;
import com.fr.json.*;
import com.fr.plugin.sqy.surface.PluginConstants;
import com.fr.plugin.sqy.surface.config.AxisConfig;
import com.fr.plugin.sqy.surface.config.LineStyleConfig;
import com.fr.plugin.sqy.surface.option.ChartOption;
import com.fr.plugin.sqy.surface.option.SurfaceChartOptionBuilder;
import com.fr.plugin.sqy.surface.option.modle.ChartOptionDirector;
import com.fr.stable.AssistUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.web.Repository;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import java.util.ArrayList;
import java.util.List;
public class Chart extends AbstractChart<ChartDataConfig> {
private static Chart chart;
private ChartType chartType = ChartType.TYPE1;
private ColorFillStyle colorFillStyle = new ColorFillStyle();
private StringFormula visualMin = new StringFormula();
private StringFormula visualMax = new StringFormula();
private LineStyleConfig wireFrameConfig = new LineStyleConfig("wireframe");
private AxisConfig axisConfigX = new AxisConfig("xAxis3d");
private AxisConfig axisConfigY = new AxisConfig("yAxis3d");
private AxisConfig axisConfigZ = new AxisConfig("zAxis3d");
public Chart() {
}
public ColorFillStyle getColorFillStyle() {
return colorFillStyle;
}
public void setColorFillStyle(ColorFillStyle colorFillStyle) {
this.colorFillStyle = colorFillStyle;
}
public StringFormula getVisualMin() {
return visualMin;
}
public void setVisualMin(StringFormula visualMin) {
this.visualMin = visualMin;
}
public StringFormula getVisualMax() {
return visualMax;
}
public void setVisualMax(StringFormula visualMax) {
this.visualMax = visualMax;
}
public LineStyleConfig getWireFrameConfig() {
return wireFrameConfig;
}
public void setWireFrameConfig(LineStyleConfig wireFrameConfig) {
this.wireFrameConfig = wireFrameConfig;
}
public AxisConfig getAxisConfigX() {
return axisConfigX;
}
public void setAxisConfigX(AxisConfig axisConfigX) {
this.axisConfigX = axisConfigX;
}
public AxisConfig getAxisConfigY() {
return axisConfigY;
}
public void setAxisConfigY(AxisConfig axisConfigY) {
this.axisConfigY = axisConfigY;
}
public AxisConfig getAxisConfigZ() {
return axisConfigZ;
}
public void setAxisConfigZ(AxisConfig axisConfigZ) {
this.axisConfigZ = axisConfigZ;
}
@Override
protected void readAttr(XMLableReader reader) {
super.readAttr(reader);
//用来标记主属性
String attrAsString = reader.getAttrAsString("mainAttr", "");
if("main".equals(attrAsString)){
this.setChartType(ChartType.parseInt(reader.getAttrAsInt("chartType", 0)));
this.getVisualMin().readAttr("visualMin",reader);
this.getVisualMax().readAttr("visualMax",reader);
this.getWireFrameConfig().readAttr("",reader);
this.getAxisConfigX().readAttr("",reader);
this.getAxisConfigY().readAttr("",reader);
this.getAxisConfigZ().readAttr("",reader);
}
}
@Override
public void readXML(XMLableReader xmLableReader) {
super.readXML(xmLableReader);
colorFillStyle.readXML(xmLableReader);
}
@Override
protected void writeAttr(XMLPrintWriter writer) {
super.writeAttr(writer);
writer.attr("mainAttr", "main");
writer.attr("chartType", getChartType().ordinal());
this.getVisualMax().writeAttr("visualMax",writer);
this.getVisualMin().writeAttr("visualMin",writer);
this.getWireFrameConfig().writeAttr("",writer);
this.getAxisConfigX().writeAttr("",writer);
this.getAxisConfigY().writeAttr("",writer);
this.getAxisConfigZ().writeAttr("",writer);
}
@Override
public void writeXML(XMLPrintWriter xmlPrintWriter) {
super.writeXML(xmlPrintWriter);
colorFillStyle.writeXML(xmlPrintWriter);
}
@Override
protected void addJSON(ChartDataConfig surfaceChartDataConfig, JSONObject jsonObject, Repository repository, AbstractChart<ChartDataConfig>.JSONPara jsonPara) throws JSONException {
//去掉试用字符
jsonObject.remove("trialLicenseWater");
jsonObject.put("trialLicenseWater","");
NameJavaScriptGroup linkGroup = this.getLinkGroup();
JSONArray jsArray = JSONKit.createJSONArray();
if(linkGroup != null && linkGroup.size() >= 1){
for (int i = 0; i < linkGroup.size(); i++) {
jsArray.put(linkGroup.getNameHyperlink(i).getJavaScript().createJSONObject(repository));
}
}
jsonObject.put("links",jsArray);
SurfaceChartOptionBuilder surfaceChartOptionBuilder = new SurfaceChartOptionBuilder();
if (surfaceChartDataConfig != null) {
surfaceChartOptionBuilder.setValuesX(surfaceChartDataConfig.getX().getValues());
surfaceChartOptionBuilder.setValuesY(surfaceChartDataConfig.getY().getValues());
surfaceChartOptionBuilder.setSeriesFiles(surfaceChartDataConfig.getCustomFields());
surfaceChartOptionBuilder.setCustomValueField(surfaceChartDataConfig.getCustomValueField().getValues());
}
surfaceChartOptionBuilder.setColors(this.getColorFillStyle().getColorList());
surfaceChartOptionBuilder.setVisualMax(this.getVisualMax().getResult());
surfaceChartOptionBuilder.setVisualMin(this.getVisualMin().getResult());
surfaceChartOptionBuilder.setWireFrameConfig(this.getWireFrameConfig());
surfaceChartOptionBuilder.setAxisConfigX(this.getAxisConfigX());
surfaceChartOptionBuilder.setAxisConfigY(this.getAxisConfigY());
surfaceChartOptionBuilder.setAxisConfigZ(this.getAxisConfigZ());
//构建echarts的option对象
ChartOption chartOptionByModel = ChartOptionDirector.createChartOptionByModel(surfaceChartOptionBuilder);
jsonObject.put("data",chartOptionByModel.getJSONObject());
}
@Override
public int hashCode() {
return super.hashCode() + AssistUtils.hashCode(getChartType(),getVisualMin(),getVisualMax());
}
@Override
public boolean equals(Object ob) {
return ob instanceof Chart
&& super.equals(ob)
&& AssistUtils.equals(this.getChartType(), ((Chart) ob).getChartType())
&& AssistUtils.equals(this.getVisualMin(), ((Chart) ob).getVisualMin())
&& AssistUtils.equals(this.getVisualMax(), ((Chart) ob).getVisualMax());
}
@Override
public Object clone() throws CloneNotSupportedException {
Chart clone = (Chart)super.clone();
clone.setChartType(this.getChartType());
clone.setVisualMax(this.getVisualMax().clone());
clone.setVisualMin(this.getVisualMin().clone());
return clone;
}
@Override
protected List<StringFormula> formulas() {
ArrayList<StringFormula> stringFormulas = new ArrayList<>();
stringFormulas.add(this.getVisualMin());
stringFormulas.add(this.getVisualMax());
stringFormulas.add(this.getAxisConfigX().getName());
stringFormulas.add(this.getAxisConfigX().getMax());
stringFormulas.add(this.getAxisConfigX().getMin());
stringFormulas.add(this.getAxisConfigY().getName());
stringFormulas.add(this.getAxisConfigY().getMax());
stringFormulas.add(this.getAxisConfigY().getMin());
stringFormulas.add(this.getAxisConfigZ().getName());
stringFormulas.add(this.getAxisConfigZ().getMax());
stringFormulas.add(this.getAxisConfigZ().getMin());
return stringFormulas;
}
@Override
protected String[] requiredJS() {
return new String[]{
"com/fr/plugin/sqy/surface/js/index.js",
"com/fr/plugin/sqy/surface/js/echarts.js",
"com/fr/plugin/sqy/surface/js/echarts-gl.js"
};
}
@Override
protected String[] requiredCSS() {
return new String[]{
"com/fr/plugin/sqy/surface/css/index.css"
};
}
@Override
protected String getChartID() {
return PluginConstants.PLOT_ID;
}
@Override
public String getChartName() {
return PluginConstants.CHART_NAME;
}
@Override
protected String wrapperName() {
return "surfaceWrapper";
}
@Override
protected HyperLinkPara[] hyperLinkParas() {
return new HyperLinkPara[]{
new HyperLinkPara() {
@Override
public String getName() {
return "X值";
}
@Override
public String getFormulaContent() {
return "X";
}
@Override
public String[] getProps() {
return new String[]{"data", "x"};
}
},
new HyperLinkPara() {
@Override
public String getName() {
return "Y值";
}
@Override
public String getFormulaContent() {
return "Y";
}
@Override
public String[] getProps() {
return new String[]{"data", "y"};
}
},
new HyperLinkPara() {
@Override
public String getName() {
return "Z值";
}
@Override
public String getFormulaContent() {
return "Z";
}
@Override
public String[] getProps() {
return new String[]{"data", "z"};
}
},
new HyperLinkPara() {
@Override
public String getName() {
return "系列名";
}
@Override
public String getFormulaContent() {
return "SERIES_NAME";
}
@Override
public String[] getProps() {
return new String[]{"data", "SERIES_NAME"};
}
}
};
}
@Override
protected String demoImagePath() {
return "com/fr/plugin/sqy/surface/img/face.png";
}
public ChartType getChartType() {
return chartType;
}
public void setChartType(ChartType chartType) {
this.chartType = chartType;
}
}

100
src/main/java/com/fr/plugin/sqy/surface/chart/ChartDataConfig.java

@ -0,0 +1,100 @@
package com.fr.plugin.sqy.surface.chart;
import com.fr.extended.chart.AbstractDataConfig;
import com.fr.extended.chart.ExtendedField;
import com.fr.stable.AssistUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
public class ChartDataConfig extends AbstractDataConfig {
private ExtendedField x = new ExtendedField();
private ExtendedField y = new ExtendedField();
private ExtendedField z = new ExtendedField();
private String tarName;
public ExtendedField getX() {
return x;
}
public void setX(ExtendedField x) {
this.x = x;
}
public ExtendedField getY() {
return y;
}
public void setY(ExtendedField y) {
this.y = y;
}
public ExtendedField getZ() {
return z;
}
public void setZ(ExtendedField z) {
this.z = z;
}
public String getTarName() {
return tarName;
}
public void setTarName(String tarName) {
this.tarName = tarName;
}
@Override
protected void readAttr(XMLableReader xmLableReader) {
readExtendedField(x, "x", xmLableReader);
readExtendedField(y, "y", xmLableReader);
readExtendedField(z, "z", xmLableReader);
setTarName(xmLableReader.getAttrAsString("tarName",""));
}
@Override
protected void writeAttr(XMLPrintWriter xmlPrintWriter) {
writeExtendedField(x, "x", xmlPrintWriter);
writeExtendedField(y, "y", xmlPrintWriter);
writeExtendedField(z, "z", xmlPrintWriter);
xmlPrintWriter.attr("tarName",getTarName());
}
@Override
public ExtendedField[] dataSetFields() {
return new ExtendedField[]{
x,
y,
z
};
}
@Override
public AbstractDataConfig clone() throws CloneNotSupportedException {
ChartDataConfig result = (ChartDataConfig)super.clone();
result.setX(getX().clone());
result.setY(getY().clone());
result.setZ(getZ().clone());
result.setTarName(getTarName());
return result;
}
@Override
public int hashCode() {
return super.hashCode()+ AssistUtils.hashCode(getX(),getY(),getZ(),getTarName());
}
@Override
public boolean equals(Object o) {
return o instanceof ChartDataConfig
&& super.equals(o)
&& AssistUtils.equals(getX(),((ChartDataConfig)o).getX())
&& AssistUtils.equals(getY(),((ChartDataConfig)o).getY())
&& AssistUtils.equals(getZ(),((ChartDataConfig)o).getZ())
&& AssistUtils.equals(getTarName(),((ChartDataConfig)o).getTarName());
}
}

16
src/main/java/com/fr/plugin/sqy/surface/chart/ChartType.java

@ -0,0 +1,16 @@
package com.fr.plugin.sqy.surface.chart;
public enum ChartType {
TYPE1,
TYPE2;
public static ChartType parseInt(int index) {
for (ChartType type : ChartType.values()) {
if (type.ordinal() == index) {
return type;
}
}
return TYPE1;
}
}

131
src/main/java/com/fr/plugin/sqy/surface/config/AxisConfig.java

@ -0,0 +1,131 @@
package com.fr.plugin.sqy.surface.config;
import com.fr.extended.chart.StringFormula;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
public class AxisConfig implements ConfigProvider{
private String id;
private StringFormula name = new StringFormula();
private String type;
private String nameLocation;
private StringFormula min = new StringFormula();
private StringFormula max = new StringFormula();
private final LabelConfig nameTextStyle = new LabelConfig("nameTextStyle");
private final LabelConfig axisLabel = new LabelConfig("axisLabel");
private final ShowConfig axisTick = new ShowConfig("axisTick");
private final LineStyleConfig axisLine = new LineStyleConfig("axisLine");
private final LineStyleConfig splitLine = new LineStyleConfig("splitLine");
private AxisConfig() {
}
public AxisConfig(String id) {
this.id = id;
}
public StringFormula getMin() {
return min;
}
public void setMin(StringFormula min) {
this.min = min;
}
public StringFormula getMax() {
return max;
}
public void setMax(StringFormula max) {
this.max = max;
}
public String getId() {
return id;
}
public StringFormula getName() {
return name;
}
public String getType() {
return type;
}
public String getNameLocation() {
return nameLocation;
}
public LabelConfig getNameTextStyle() {
return nameTextStyle;
}
public LabelConfig getAxisLabel() {
return axisLabel;
}
public ShowConfig getAxisTick() {
return axisTick;
}
public LineStyleConfig getAxisLine() {
return axisLine;
}
public LineStyleConfig getSplitLine() {
return splitLine;
}
public void setName(StringFormula name) {
this.name = name;
}
public void setType(String type) {
this.type = type;
}
public void setNameLocation(String nameLocation) {
this.nameLocation = nameLocation;
}
private String concatName(String name1,String name2){
if(StringUtils.isBlank(name2)){
return name1 + "_" + this.getId();
}
return name1 + "_" + this.getId() + "_" + name2;
}
@Override
public void writeAttr(String var1, XMLPrintWriter var2) {
var2.attr(concatName(var1,"name"),this.getName().getContent());
var2.attr(concatName(var1,"type"),this.getType());
var2.attr(concatName(var1,"nameLocation"),this.getNameLocation());
var2.attr(concatName(var1,"min"),this.getMin().getContent());
var2.attr(concatName(var1,"max"),this.getMax().getContent());
this.getNameTextStyle().writeAttr(concatName(var1,""),var2);
this.getAxisLabel().writeAttr(concatName(var1,""),var2);
this.getAxisTick().writeAttr(concatName(var1,""),var2);
this.getAxisLine().writeAttr(concatName(var1,""),var2);
this.getSplitLine().writeAttr(concatName(var1,""),var2);
}
@Override
public void readAttr(String var1, XMLableReader var2) {
this.getName().setContent(var2.getAttrAsString(concatName(var1,"name"),""));
this.setType(var2.getAttrAsString(concatName(var1,"type"),""));
this.setNameLocation(var2.getAttrAsString(concatName(var1,"nameLocation"),""));
this.getMin().setContent(var2.getAttrAsString(concatName(var1,"min"),""));
this.getMax().setContent(var2.getAttrAsString(concatName(var1,"max"),""));
this.getNameTextStyle().readAttr(concatName(var1,""),var2);
this.getAxisLabel().readAttr(concatName(var1,""),var2);
this.getAxisTick().readAttr(concatName(var1,""),var2);
this.getAxisLine().readAttr(concatName(var1,""),var2);
this.getSplitLine().readAttr(concatName(var1,""),var2);
}
}

9
src/main/java/com/fr/plugin/sqy/surface/config/ConfigProvider.java

@ -0,0 +1,9 @@
package com.fr.plugin.sqy.surface.config;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
public interface ConfigProvider {
public void writeAttr(String var1, XMLPrintWriter var2);
public void readAttr(String var1, XMLableReader var2);
}

83
src/main/java/com/fr/plugin/sqy/surface/config/LabelConfig.java

@ -0,0 +1,83 @@
package com.fr.plugin.sqy.surface.config;
import com.fr.plugin.sqy.surface.util.PluginStringUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import java.awt.*;
public class LabelConfig implements ConfigProvider{
private String id;
private boolean show;
private Color color = new Color(0x000000);
private int fontSize;
private String formatter;
private LabelConfig(){
}
public LabelConfig(String id) {
this.id = id;
}
public String getId() {
return id;
}
public boolean isShow() {
return show;
}
public void setShow(boolean show) {
this.show = show;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public int getFontSize() {
return fontSize;
}
public void setFontSize(int fontSize) {
this.fontSize = fontSize;
}
public String getFormatter() {
return formatter;
}
public void setFormatter(String formatter) {
this.formatter = formatter;
}
private String concatName(String name1, String name2){
if(StringUtils.isBlank(name2)){
return name1 + "_" + this.getId();
}
return name1 + "_" + this.getId() + "_" + name2;
}
@Override
public void writeAttr(String var1, XMLPrintWriter var2) {
var2.attr(concatName(var1,"show"),this.isShow());
var2.attr(concatName(var1,"color"), this.getColor().getRGB());
var2.attr(concatName(var1,"fontSize"),this.getFontSize());
var2.attr(concatName(var1,"formatter"),this.getFormatter());
}
@Override
public void readAttr(String var1, XMLableReader var2) {
this.setShow(var2.getAttrAsBoolean(concatName(var1,"show"),true));
this.setColor(new Color(var2.getAttrAsInt(concatName(var1,"color"),new Color(0x000000).getRGB())));
this.setFontSize(var2.getAttrAsInt(concatName(var1,"fontSize"),0));
this.setFormatter(var2.getAttrAsString(concatName(var1,"formatter"),""));
}
}

70
src/main/java/com/fr/plugin/sqy/surface/config/LineStyleConfig.java

@ -0,0 +1,70 @@
package com.fr.plugin.sqy.surface.config;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import java.awt.*;
public class LineStyleConfig implements ConfigProvider{
private String id;
private Color color = new Color(0x000000);
private double width;
private String type;
private LineStyleConfig() {
}
public LineStyleConfig(String id) {
this.id = id;
}
public String getId() {
return id;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
private String concatName(String name1,String name2){
if(StringUtils.isBlank(name2)){
return name1 + "_" + this.getId();
}
return name1 + "_" + this.getId() + "_" + name2;
}
@Override
public void writeAttr(String var1, XMLPrintWriter var2) {
var2.attr(concatName(var1,"color"),this.getColor().getRGB());
var2.attr(concatName(var1,"width"),this.getWidth());
var2.attr(concatName(var1,"type"),this.getType());
}
@Override
public void readAttr(String var1, XMLableReader var2) {
this.setColor(new Color(var2.getAttrAsInt(concatName(var1,"color"),new Color(0x000000).getRGB())));
this.setWidth(var2.getAttrAsDouble(concatName(var1,"width"),1D));
this.setType(var2.getAttrAsString(concatName(var1,"type"),""));
}
}

45
src/main/java/com/fr/plugin/sqy/surface/config/ShowConfig.java

@ -0,0 +1,45 @@
package com.fr.plugin.sqy.surface.config;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
public class ShowConfig implements ConfigProvider{
private boolean show;
private String id;
private ShowConfig(){
}
public ShowConfig(String id) {
this.id = id;
}
public String getId() {
return id;
}
public boolean isShow() {
return show;
}
public void setShow(boolean show) {
this.show = show;
}
private String concatName(String name1,String name2){
if(StringUtils.isBlank(name2)){
return name1 + "_" + this.getId();
}
return name1 + "_" + this.getId() + "_" + name2;
}
@Override
public void writeAttr(String var1, XMLPrintWriter var2) {
var2.attr(concatName(var1,"show"),this.isShow());
}
@Override
public void readAttr(String var1, XMLableReader var2) {
this.setShow(var2.getAttrAsBoolean(concatName(var1,"show"),true));
}
}

182
src/main/java/com/fr/plugin/sqy/surface/option/Axis3D.java

@ -0,0 +1,182 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
import com.fr.plugin.sqy.surface.zenum.AxisTypeEnum;
import com.fr.stable.StringUtils;
import java.util.List;
/**
* 坐标轴
*/
public class Axis3D implements OptionProvider {
/**
* 坐标轴类型
*/
private String type;
/**
* 坐标轴名称
*/
private String name;
/**
* 坐标轴名称位置
*/
private String nameLocation;
/**
* 坐标轴值 类目数据在类目轴type: 'category'中有效
*/
private List<Object> data;
private Double min;
private Double max;
private boolean boundaryGap = true;
private LabelStyle nameTextStyle;
private LabelStyle axisLabel;
private AxisTick axisTick;
private AxisLine axisLine;
private SplitLine splitLine;
public Double getMin() {
return min;
}
public void setMin(Double min) {
this.min = min;
}
public Double getMax() {
return max;
}
public void setMax(Double max) {
this.max = max;
}
public boolean isBoundaryGap() {
return boundaryGap;
}
public void setBoundaryGap(boolean boundaryGap) {
this.boundaryGap = boundaryGap;
}
public LabelStyle getNameTextStyle() {
return nameTextStyle;
}
public void setNameTextStyle(LabelStyle nameTextStyle) {
this.nameTextStyle = nameTextStyle;
}
public LabelStyle getAxisLabel() {
return axisLabel;
}
public void setAxisLabel(LabelStyle axisLabel) {
this.axisLabel = axisLabel;
}
public AxisTick getAxisTick() {
return axisTick;
}
public void setAxisTick(AxisTick axisTick) {
this.axisTick = axisTick;
}
public AxisLine getAxisLine() {
return axisLine;
}
public void setAxisLine(AxisLine axisLine) {
this.axisLine = axisLine;
}
public SplitLine getSplitLine() {
return splitLine;
}
public void setSplitLine(SplitLine splitLine) {
this.splitLine = splitLine;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNameLocation() {
return nameLocation;
}
public void setNameLocation(String nameLocation) {
this.nameLocation = nameLocation;
}
public List<Object> getData() {
return data;
}
public void setData(List<Object> data) {
this.data = data;
}
public JSONObject getJSONObject(){
JSONObject axis3D = JSONKit.create();
axis3D.put("type",AxisTypeEnum.parseString(this.getType()).getName());
axis3D.put("name",this.getName());
if(this.getData() != null){
JSONArray dataJSONArray = JSONKit.createJSONArray();
for (int i = 0; i < data.size(); i++) {
dataJSONArray.put(data.get(i));
}
axis3D.put("data",dataJSONArray);
}
axis3D.put("boundaryGap",this.isBoundaryGap());
if(this.getAxisLabel() != null){
axis3D.put("axisLabel",this.getAxisLabel().getJSONObject());
}
if(this.getAxisTick() != null){
axis3D.put("axisTick",this.getAxisTick().getJSONObject());
}
if(this.getAxisLine() != null){
axis3D.put("axisLine",this.getAxisLine().getJSONObject());
}
if(this.getSplitLine() != null){
axis3D.put("splitLine",this.getSplitLine().getJSONObject());
}
if(this.getNameTextStyle() != null){
axis3D.put("nameTextStyle",this.getNameTextStyle().getJSONObject());
}
if(this.getMax() != null){
axis3D.put("max",this.getMax());
}
if(this.getMin() != null){
axis3D.put("min",this.getMin());
}
return axis3D;
}
}

48
src/main/java/com/fr/plugin/sqy/surface/option/AxisLine.java

@ -0,0 +1,48 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
public class AxisLine implements OptionProvider {
private boolean show = true;
private LineStyle lineStyle;
public AxisLine() {
}
public AxisLine(boolean show) {
this.show = show;
}
public AxisLine(boolean show, LineStyle lineStyle) {
this.show = show;
this.lineStyle = lineStyle;
}
public boolean isShow() {
return show;
}
public void setShow(boolean show) {
this.show = show;
}
public LineStyle getLineStyle() {
return lineStyle;
}
public void setLineStyle(LineStyle lineStyle) {
this.lineStyle = lineStyle;
}
@Override
public JSONObject getJSONObject() {
JSONObject axisLine = JSONKit.create();
axisLine.put("show",this.isShow());
if(this.getLineStyle() != null){
axisLine.put("lineStyle",this.getLineStyle().getJSONObject());
}
return axisLine;
}
}

31
src/main/java/com/fr/plugin/sqy/surface/option/AxisTick.java

@ -0,0 +1,31 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
public class AxisTick implements OptionProvider {
private boolean show = true;
public AxisTick() {
}
public AxisTick(boolean show) {
this.show = show;
}
public boolean isShow() {
return show;
}
public void setShow(boolean show) {
this.show = show;
}
@Override
public JSONObject getJSONObject() {
JSONObject axisTick = JSONKit.create();
axisTick.put("show",this.isShow());
return axisTick;
}
}

107
src/main/java/com/fr/plugin/sqy/surface/option/ChartOption.java

@ -0,0 +1,107 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
import com.fr.stable.StringUtils;
import java.util.List;
public class ChartOption implements OptionProvider {
private ToolTip tooltip;
private String backGroundColor;
private VisualMap visualMap;
private Axis3D axis3Dx;
private Axis3D axis3Dy;
private Axis3D axis3Dz;
private Grid3D grid3D;
private List<Series> series;
public ToolTip getTooltip() {
return tooltip;
}
public void setTooltip(ToolTip tooltip) {
this.tooltip = tooltip;
}
public String getBackGroundColor() {
return backGroundColor;
}
public void setBackGroundColor(String backGroundColor) {
this.backGroundColor = backGroundColor;
}
public VisualMap getVisualMap() {
return visualMap;
}
public void setVisualMap(VisualMap visualMap) {
this.visualMap = visualMap;
}
public Axis3D getAxis3Dx() {
return axis3Dx;
}
public void setAxis3Dx(Axis3D axis3Dx) {
this.axis3Dx = axis3Dx;
}
public Axis3D getAxis3Dy() {
return axis3Dy;
}
public void setAxis3Dy(Axis3D axis3Dy) {
this.axis3Dy = axis3Dy;
}
public Axis3D getAxis3Dz() {
return axis3Dz;
}
public void setAxis3Dz(Axis3D axis3Dz) {
this.axis3Dz = axis3Dz;
}
public Grid3D getGrid3D() {
return grid3D;
}
public void setGrid3D(Grid3D grid3D) {
this.grid3D = grid3D;
}
public List<Series> getSeries() {
return series;
}
public void setSeries(List<Series> series) {
this.series = series;
}
public JSONObject getJSONObject(){
JSONObject option = JSONKit.create();
option.put("tooltip",this.getTooltip() == null ? JSONKit.create() : this.getTooltip().getJSONObject());
if(!StringUtils.isBlank(this.getBackGroundColor())){
option.put("backgroundColor",this.getBackGroundColor());
}
option.put("visualMap",this.getVisualMap() == null ? new VisualMap().getJSONObject() : this.getVisualMap().getJSONObject());
option.put("xAxis3D",this.getAxis3Dx()==null ? new Axis3D().getJSONObject() : this.getAxis3Dx().getJSONObject());
option.put("yAxis3D",this.getAxis3Dy()==null ? new Axis3D().getJSONObject() : this.getAxis3Dy().getJSONObject());
option.put("zAxis3D",this.getAxis3Dz()==null ? new Axis3D().getJSONObject() : this.getAxis3Dz().getJSONObject());
option.put("grid3D",this.getGrid3D() == null ? JSONKit.create() : this.getGrid3D().getJSONObject());
JSONArray seriesJSONArray = JSONKit.createJSONArray();
if(this.getSeries() != null){
for (int i = 0; i < this.getSeries().size(); i++) {
seriesJSONArray.put(this.getSeries().get(i).getJSONObject());
}
}
option.put("series",seriesJSONArray);
return option;
}
}

26
src/main/java/com/fr/plugin/sqy/surface/option/Grid3D.java

@ -0,0 +1,26 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
/**
* 图表网格
*/
public class Grid3D implements OptionProvider {
private String top = "middle";
public String getTop() {
return top;
}
public void setTop(String top) {
this.top = top;
}
public JSONObject getJSONObject(){
JSONObject grid3D = JSONKit.create();
grid3D.put("top",this.getTop());
return grid3D;
}
}

62
src/main/java/com/fr/plugin/sqy/surface/option/LabelStyle.java

@ -0,0 +1,62 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
import com.fr.plugin.sqy.surface.util.PluginStringUtils;
import com.fr.stable.StringUtils;
import java.awt.*;
public class LabelStyle implements OptionProvider {
private Color color;
private int fontsize;
private String formatter;
public LabelStyle() {
}
public LabelStyle(Color color, int fontsize) {
this.color = color;
this.fontsize = fontsize;
}
public String getFormatter() {
return formatter;
}
public void setFormatter(String formatter) {
this.formatter = formatter;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public int getFontsize() {
return fontsize;
}
public void setFontsize(int fontsize) {
this.fontsize = fontsize;
}
@Override
public JSONObject getJSONObject() {
JSONObject labelStyle = JSONKit.create();
if(this.getColor() != null){
labelStyle.put("color", PluginStringUtils.colorToString(this.getColor()));
}
if(this.getFontsize() != 0){
labelStyle.put("fontSize",this.getFontsize());
}
if(StringUtils.isNotBlank(this.getFormatter())){
labelStyle.put("formatter",this.getFormatter());
}
return labelStyle;
}
}

65
src/main/java/com/fr/plugin/sqy/surface/option/LineStyle.java

@ -0,0 +1,65 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.finebi.cbb.utils.data.NumberUtils;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
import com.fr.plugin.sqy.surface.util.PluginStringUtils;
import com.fr.stable.StringUtils;
import java.awt.*;
public class LineStyle implements OptionProvider {
private Color color;
private double width;
private String type;
public LineStyle() {
}
public LineStyle(Color color, double width, String type) {
this.color = color;
this.width = width;
this.type = type;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public JSONObject getJSONObject() {
JSONObject lineStyle = JSONKit.create();
if(this.getColor() != null){
lineStyle.put("color", PluginStringUtils.colorToString(this.getColor()));
}
if(this.getWidth() != 0){
lineStyle.put("width",this.getWidth());
}
if(StringUtils.isNotBlank(this.getType())){
lineStyle.put("type",this.getType());
}
return lineStyle;
}
}

69
src/main/java/com/fr/plugin/sqy/surface/option/Series.java

@ -0,0 +1,69 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
import com.fr.stable.StringUtils;
import java.util.List;
public class Series implements OptionProvider {
private String type = "surface";
private List<Object> data;
private String name;
private Wireframe wireframe;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<Object> getData() {
return data;
}
public void setData(List<Object> data) {
this.data = data;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Wireframe getWireframe() {
return wireframe;
}
public void setWireframe(Wireframe wireframe) {
this.wireframe = wireframe;
}
public JSONObject getJSONObject(){
JSONObject series = JSONKit.create();
series.put("type",this.getType());
JSONArray dataJSONArray = JSONKit.createJSONArray();
if(this.getData() != null){
for (int i = 0; i < data.size(); i++) {
dataJSONArray.put(data.get(i));
}
}
series.put("data",dataJSONArray);
if(!StringUtils.isBlank(this.getName())){
series.put("name",this.getName());
}
if(this.getWireframe() != null){
series.put("wireframe",this.getWireframe().getJSONObject());
}
return series;
}
}

48
src/main/java/com/fr/plugin/sqy/surface/option/SplitLine.java

@ -0,0 +1,48 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
public class SplitLine implements OptionProvider {
private boolean show = true;
private LineStyle lineStyle;
public SplitLine() {
}
public SplitLine(boolean show) {
this.show = show;
}
public SplitLine(boolean show, LineStyle lineStyle) {
this.show = show;
this.lineStyle = lineStyle;
}
public boolean isShow() {
return show;
}
public void setShow(boolean show) {
this.show = show;
}
public LineStyle getLineStyle() {
return lineStyle;
}
public void setLineStyle(LineStyle lineStyle) {
this.lineStyle = lineStyle;
}
@Override
public JSONObject getJSONObject() {
JSONObject splitLine = JSONKit.create();
splitLine.put("show",this.isShow());
if(this.getLineStyle() != null){
splitLine.put("lineStyle",this.getLineStyle().getJSONObject());
}
return splitLine;
}
}

415
src/main/java/com/fr/plugin/sqy/surface/option/SurfaceChartOptionBuilder.java

@ -0,0 +1,415 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.extended.chart.ExtendedField;
import com.fr.general.GeneralUtils;
import com.fr.json.JSONArray;
import com.fr.plugin.sqy.surface.config.AxisConfig;
import com.fr.plugin.sqy.surface.config.LineStyleConfig;
import com.fr.plugin.sqy.surface.option.modle.ChartOptionProvide;
import com.fr.plugin.sqy.surface.zenum.AxisTypeEnum;
import com.fr.plugin.sqy.surface.util.PluginStringUtils;
import com.fr.plugin.sqy.surface.zenum.LineTypeEnum;
import com.fr.stable.StringUtils;
import java.awt.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class SurfaceChartOptionBuilder implements ChartOptionProvide {
private ChartOption chartOption;
private List<Object> valuesX;
private List<Object> valuesY;
private List<Object> customValueField;
private List<ExtendedField> seriesFiles;
private List<Color> colors;
private String visualMin;
private String visualMax;
private LineStyleConfig wireFrameConfig;
private AxisConfig axisConfigX;
private AxisConfig axisConfigY;
private AxisConfig axisConfigZ;
public AxisConfig getAxisConfigX() {
return axisConfigX;
}
public void setAxisConfigX(AxisConfig axisConfigX) {
this.axisConfigX = axisConfigX;
}
public AxisConfig getAxisConfigY() {
return axisConfigY;
}
public void setAxisConfigY(AxisConfig axisConfigY) {
this.axisConfigY = axisConfigY;
}
public AxisConfig getAxisConfigZ() {
return axisConfigZ;
}
public void setAxisConfigZ(AxisConfig axisConfigZ) {
this.axisConfigZ = axisConfigZ;
}
public LineStyleConfig getWireFrameConfig() {
return wireFrameConfig;
}
public void setWireFrameConfig(LineStyleConfig wireFrameConfig) {
this.wireFrameConfig = wireFrameConfig;
}
public String getVisualMin() {
return visualMin;
}
public void setVisualMin(String visualMin) {
this.visualMin = visualMin;
}
public String getVisualMax() {
return visualMax;
}
public void setVisualMax(String visualMax) {
this.visualMax = visualMax;
}
public List<Color> getColors() {
return colors;
}
public void setColors(List<Color> colors) {
this.colors = colors;
}
public List<Object> getCustomValueField() {
return customValueField;
}
public void setCustomValueField(List<Object> customValueField) {
this.customValueField = customValueField;
}
public List<Object> getValuesX() {
return valuesX;
}
public void setValuesX(List<Object> valuesX) {
this.valuesX = valuesX;
}
public List<Object> getValuesY() {
return valuesY;
}
public void setValuesY(List<Object> valuesY) {
this.valuesY = valuesY;
}
public List<ExtendedField> getSeriesFiles() {
return seriesFiles;
}
public void setSeriesFiles(List<ExtendedField> seriesFiles) {
this.seriesFiles = seriesFiles;
}
public SurfaceChartOptionBuilder() {
chartOption = new ChartOption();
}
@Override
public void buildToolTip() {
}
@Override
public void buildVisualMap() {
VisualMap visualMap = new VisualMap();
if(this.getColors() != null){
VisualMap.InRange inRange = new VisualMap.InRange();
inRange.setColor(this.getColors());
visualMap.setInRange(inRange);
}
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
if(this.getCustomValueField() != null) {
for (int i = 0; i < this.getCustomValueField().size(); i++) {
double v = GeneralUtils.objectToNumber(this.getCustomValueField().get(i)).doubleValue();
min = Math.min(v, min);
max = Math.max(v, max);
}
}
if(StringUtils.isNotBlank(visualMin) && PluginStringUtils.isNumber(visualMin)){
min = Double.parseDouble(visualMin);
}
if(StringUtils.isNotBlank(visualMax) && PluginStringUtils.isNumber(visualMax)){
max = Double.parseDouble(visualMax);
}
visualMap.setMax(max);
visualMap.setMin(min);
this.chartOption.setVisualMap(visualMap);
}
@Override
public void buildAxis3Dx() {
Axis3D axis3D = new Axis3D();
AxisConfig axisConfig = this.getAxisConfigX();
//设置轴标题
if(axisConfig.getNameTextStyle().isShow()){
axis3D.setName(axisConfig.getName().getResult());
axis3D.setNameTextStyle(new LabelStyle(axisConfig.getNameTextStyle().getColor(), axisConfig.getNameTextStyle().getFontSize()));
}else{
axis3D.setName("");
}
//设置轴标签
if(axisConfig.getAxisLabel().isShow()){
axis3D.setAxisLabel(new LabelStyle(axisConfig.getAxisLabel().getColor(),axisConfig.getAxisLabel().getFontSize()));
if(StringUtils.isNotBlank(axisConfig.getAxisLabel().getFormatter())){
axis3D.getAxisLabel().setFormatter(axisConfig.getAxisLabel().getFormatter());
}
}
//设置轴线
if(LineTypeEnum.parseString(axisConfig.getAxisLine().getType()).ordinal() == 0){
axis3D.setAxisLine(new AxisLine(false));
}else{
axis3D.setAxisLine(new AxisLine(true,new LineStyle(axisConfig.getAxisLine().getColor(),axisConfig.getAxisLine().getWidth(),axisConfig.getAxisLine().getType())));
axis3D.setAxisTick(new AxisTick(axisConfig.getAxisTick().isShow()));
}
//设置网格线
if(LineTypeEnum.parseString(axisConfig.getSplitLine().getType()).ordinal() == 0){
axis3D.setSplitLine(new SplitLine(false));
}else{
axis3D.setSplitLine(new SplitLine(true,new LineStyle(axisConfig.getSplitLine().getColor(),axisConfig.getSplitLine().getWidth(),axisConfig.getSplitLine().getType())));
}
//设置值类型
if(AxisTypeEnum.parseString(axisConfig.getType()).ordinal() == 0){
if(this.getValuesX()!=null && this.getValuesX().size()>0 && (this.getValuesX().get(0) instanceof String)){
axis3D.setType(AxisTypeEnum.CATEGORY.getName());
axis3D.setBoundaryGap(false);
axis3D.setMax(null);
axis3D.setMin(null);
}else{
axis3D.setType(axisConfig.getType());
String min = axisConfig.getMin().getResult();
if(PluginStringUtils.isNumber(min)){
axis3D.setMin(Double.valueOf(min));
}
String max = axisConfig.getMax().getResult();
if(PluginStringUtils.isNumber(max)){
axis3D.setMax(Double.valueOf(max));
}
}
}else{
axis3D.setType(axisConfig.getType());
axis3D.setBoundaryGap(false);
}
this.chartOption.setAxis3Dx(axis3D);
}
@Override
public void buildAxis3Dy() {
Axis3D axis3D = new Axis3D();
AxisConfig axisConfig = this.getAxisConfigY();
//设置轴标题
if(axisConfig.getNameTextStyle().isShow()){
axis3D.setName(axisConfig.getName().getResult());
axis3D.setNameTextStyle(new LabelStyle(axisConfig.getNameTextStyle().getColor(), axisConfig.getNameTextStyle().getFontSize()));
}else{
axis3D.setName("");
}
//设置轴标签
if(axisConfig.getAxisLabel().isShow()){
axis3D.setAxisLabel(new LabelStyle(axisConfig.getAxisLabel().getColor(),axisConfig.getAxisLabel().getFontSize()));
if(StringUtils.isNotBlank(axisConfig.getAxisLabel().getFormatter())){
axis3D.getAxisLabel().setFormatter(axisConfig.getAxisLabel().getFormatter());
}
}
//设置轴线
if(LineTypeEnum.parseString(axisConfig.getAxisLine().getType()).ordinal() == 0){
axis3D.setAxisLine(new AxisLine(false));
}else{
axis3D.setAxisLine(new AxisLine(true,new LineStyle(axisConfig.getAxisLine().getColor(),axisConfig.getAxisLine().getWidth(),axisConfig.getAxisLine().getType())));
axis3D.setAxisTick(new AxisTick(axisConfig.getAxisTick().isShow()));
}
//设置网格线
if(LineTypeEnum.parseString(axisConfig.getSplitLine().getType()).ordinal() == 0){
axis3D.setSplitLine(new SplitLine(false));
}else{
axis3D.setSplitLine(new SplitLine(true,new LineStyle(axisConfig.getSplitLine().getColor(),axisConfig.getSplitLine().getWidth(),axisConfig.getSplitLine().getType())));
}
//设置值类型
if(AxisTypeEnum.parseString(axisConfig.getType()).ordinal() == 0){
if(this.getValuesY()!=null && this.getValuesY().size()>0 && (this.getValuesY().get(0) instanceof String)){
axis3D.setType(AxisTypeEnum.CATEGORY.getName());
axis3D.setBoundaryGap(false);
axis3D.setMax(null);
axis3D.setMin(null);
}else{
axis3D.setType(axisConfig.getType());
String min = axisConfig.getMin().getResult();
if(PluginStringUtils.isNumber(min)){
axis3D.setMin(Double.valueOf(min));
}
String max = axisConfig.getMax().getResult();
if(PluginStringUtils.isNumber(max)){
axis3D.setMax(Double.valueOf(max));
}
}
}else{
axis3D.setType(axisConfig.getType());
axis3D.setBoundaryGap(false);
}
this.chartOption.setAxis3Dy(axis3D);
}
@Override
public void buildAxis3Dz() {
Axis3D axis3D = new Axis3D();
AxisConfig axisConfig = this.getAxisConfigZ();
//设置轴标题
if(axisConfig.getNameTextStyle().isShow()){
axis3D.setName(axisConfig.getName().getResult());
axis3D.setNameTextStyle(new LabelStyle(axisConfig.getNameTextStyle().getColor(), axisConfig.getNameTextStyle().getFontSize()));
}else{
axis3D.setName("");
}
//设置轴标签
if(axisConfig.getAxisLabel().isShow()){
axis3D.setAxisLabel(new LabelStyle(axisConfig.getAxisLabel().getColor(),axisConfig.getAxisLabel().getFontSize()));
if(StringUtils.isNotBlank(axisConfig.getAxisLabel().getFormatter())){
axis3D.getAxisLabel().setFormatter(axisConfig.getAxisLabel().getFormatter());
}
}
//设置轴线
if(LineTypeEnum.parseString(axisConfig.getAxisLine().getType()).ordinal() == 0){
axis3D.setAxisLine(new AxisLine(false));
}else{
axis3D.setAxisLine(new AxisLine(true,new LineStyle(axisConfig.getAxisLine().getColor(),axisConfig.getAxisLine().getWidth(),axisConfig.getAxisLine().getType())));
axis3D.setAxisTick(new AxisTick(axisConfig.getAxisTick().isShow()));
}
//设置网格线
if(LineTypeEnum.parseString(axisConfig.getSplitLine().getType()).ordinal() == 0){
axis3D.setSplitLine(new SplitLine(false));
}else{
axis3D.setSplitLine(new SplitLine(true,new LineStyle(axisConfig.getSplitLine().getColor(),axisConfig.getSplitLine().getWidth(),axisConfig.getSplitLine().getType())));
}
//设置值类型
if(AxisTypeEnum.parseString(axisConfig.getType()).ordinal() == 0){
if(this.getCustomValueField()!=null && this.getCustomValueField().size()>0 && (this.getCustomValueField().get(0) instanceof String)){
axis3D.setType(AxisTypeEnum.CATEGORY.getName());
axis3D.setBoundaryGap(false);
axis3D.setMax(null);
axis3D.setMin(null);
}else{
axis3D.setType(axisConfig.getType());
String min = axisConfig.getMin().getResult();
if(PluginStringUtils.isNumber(min)){
axis3D.setMin(Double.valueOf(min));
}
String max = axisConfig.getMax().getResult();
if(PluginStringUtils.isNumber(max)){
axis3D.setMax(Double.valueOf(max));
}
}
}else{
axis3D.setType(axisConfig.getType());
axis3D.setBoundaryGap(false);
}
this.chartOption.setAxis3Dz(axis3D);
}
@Override
public void buildGrid3D() {
this.chartOption.setGrid3D(new Grid3D());
}
@Override
public void buildSeries() {
List<Series> seriesList = new ArrayList<>();
if(this.getSeriesFiles() != null) {
Wireframe wireframe = null;
if(this.getWireFrameConfig() != null){
wireframe = new Wireframe();
boolean isShow = LineTypeEnum.parseString(this.getWireFrameConfig().getType()).ordinal() != 0;
wireframe.setShow(isShow);
if(isShow){
LineStyle lineStyle = new LineStyle();
lineStyle.setColor(this.getWireFrameConfig().getColor());
lineStyle.setWidth(this.getWireFrameConfig().getWidth());
lineStyle.setType(this.getWireFrameConfig().getType());
wireframe.setLineStyle(lineStyle);
}
}
for (ExtendedField seriesFile : this.getSeriesFiles()) {
seriesList.add(this.buildSeries(seriesFile,wireframe));
}
}
this.chartOption.setSeries(seriesList);
}
private Series buildSeries(ExtendedField values,Wireframe wireframe){
Series series = new Series();
series.setWireframe(wireframe);
List<Object> customValues = values.getValues();
series.setName(values.getCustomName());
if(this.getValuesX() != null && this.getValuesX().size() > 0){
List<Object> dataList = new ArrayList<>();
for (int i = 0; i < valuesY.size(); i++) {
dataList.add(JSONKit.createJSONArray()
.put(valuesX.size()>i ? valuesX.get(i) : 0)
.put(valuesY.get(i))
.put(customValues.size()>i ? customValues.get(i) : 0)
);
}
//需要对数据进行排序,否则图形出不来
dataList.sort(new Comparator<Object>() {
public int compare(Object o1,Object o2){
try {
Object o1col = ((JSONArray)o1).get(1);
Object o2col = ((JSONArray)o2).get(1);
int i;
if(o1col instanceof Number){
i = Double.valueOf(String.valueOf(o1col)).compareTo(Double.valueOf(String.valueOf(o2col)));
}else{
i = String.valueOf(o1col).compareTo(String.valueOf(o2col));
}
if(i != 0){
return i;
}
o1col = ((JSONArray)o1).get(0);
o2col = ((JSONArray)o2).get(0);
if(o1col instanceof Number){
return Double.valueOf(String.valueOf(o1col)).compareTo(Double.valueOf(String.valueOf(o2col)));
}else{
return String.valueOf(o1col).compareTo(String.valueOf(o2col));
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
});
series.setData(dataList);
}
return series;
}
@Override
public ChartOption createChartOption() {
return chartOption;
}
}

16
src/main/java/com/fr/plugin/sqy/surface/option/ToolTip.java

@ -0,0 +1,16 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
/**
* 提示框配置
*/
public class ToolTip implements OptionProvider {
public JSONObject getJSONObject(){
return JSONKit.create();
}
}

146
src/main/java/com/fr/plugin/sqy/surface/option/VisualMap.java

@ -0,0 +1,146 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
import com.fr.plugin.sqy.surface.util.PluginStringUtils;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* 视觉隐射组件配置
*/
public class VisualMap implements OptionProvider {
/**
* 类型默认连续型
*/
private String type = "continuous";
/**
* 指定 visualMapContinuous 组件的允许的最小值'min' 必须用户指定[visualMap.min, visualMax.max] 形成了视觉映射的定义域
*/
private double min = -1D;
/**
* 指定 visualMapContinuous 组件的允许的最大值'max' 必须用户指定[visualMap.min, visualMax.max] 形成了视觉映射的定义域
*/
private double max = 1D;
/**
* 是否显示 visualMap-continuous 组件如果设置为 false不会显示但是数据映射的功能还存在
*/
private boolean show = false;
/**
* 指定用数据的哪个维度映射到视觉元素上 默认取 data 中最后一个维度
*/
private int dimension = 2;
/**
* 定义 在选中范围中 的视觉元素 目前定义不完善
*/
private InRange inRange = new InRange();
public JSONObject getJSONObject(){
JSONObject visualMap = JSONKit.create();
visualMap.put("show",this.isShow());
visualMap.put("dimension",this.getDimension());
visualMap.put("min",this.getMin());
visualMap.put("max",this.getMax());
visualMap.put("inRange",this.getInRange().getJSONObject());
return visualMap;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public double getMin() {
return min;
}
public void setMin(double min) {
this.min = min;
}
public double getMax() {
return max;
}
public void setMax(double max) {
this.max = max;
}
public boolean isShow() {
return show;
}
public void setShow(boolean show) {
this.show = show;
}
public int getDimension() {
return dimension;
}
public void setDimension(int dimension) {
this.dimension = dimension;
}
public InRange getInRange() {
return inRange;
}
public void setInRange(InRange inRange) {
this.inRange = inRange;
}
public static class InRange{
private List<Color> color;
public List<Color> getColor() {
return color;
}
public void setColor(List<Color> color) {
this.color = color;
}
public static List<Color> getDefaultColor(){
List<Color> colors = new ArrayList<>();
colors.add(new Color(0x313695));
colors.add(new Color(0x4575b4));
colors.add(new Color(0x74add1));
colors.add(new Color(0xabd9e9));
colors.add(new Color(0xe0f3f8));
colors.add(new Color(0xffffbf));
colors.add(new Color(0xfee090));
colors.add(new Color(0xfdae61));
colors.add(new Color(0xf46d43));
colors.add(new Color(0xd73027));
colors.add(new Color(0xa50026));
return colors;
}
public JSONObject getJSONObject(){
JSONObject inRange = JSONKit.create();
JSONArray colorJSONArray = JSONKit.createJSONArray();
if(this.getColor() == null){
this.setColor(getDefaultColor());
}
for (int i = 0; i < color.size(); i++) {
Color color = this.color.get(i);
colorJSONArray.put(PluginStringUtils.colorToString(color));
}
inRange.put("color",colorJSONArray);
return inRange;
}
}
}

36
src/main/java/com/fr/plugin/sqy/surface/option/Wireframe.java

@ -0,0 +1,36 @@
package com.fr.plugin.sqy.surface.option;
import com.fanruan.api.json.JSONKit;
import com.fr.json.JSONObject;
import com.fr.plugin.sqy.surface.option.modle.OptionProvider;
public class Wireframe implements OptionProvider {
private boolean show;
private LineStyle lineStyle;
public boolean isShow() {
return show;
}
public void setShow(boolean show) {
this.show = show;
}
public LineStyle getLineStyle() {
return lineStyle;
}
public void setLineStyle(LineStyle lineStyle) {
this.lineStyle = lineStyle;
}
@Override
public JSONObject getJSONObject() {
JSONObject wireframe = JSONKit.create();
wireframe.put("show",this.isShow());
if(this.getLineStyle() != null){
wireframe.put("lineStyle",this.getLineStyle().getJSONObject());
}
return wireframe;
}
}

16
src/main/java/com/fr/plugin/sqy/surface/option/modle/ChartOptionDirector.java

@ -0,0 +1,16 @@
package com.fr.plugin.sqy.surface.option.modle;
import com.fr.plugin.sqy.surface.option.ChartOption;
public class ChartOptionDirector {
public static ChartOption createChartOptionByModel(ChartOptionProvide builder){
builder.buildToolTip();
builder.buildAxis3Dx();
builder.buildAxis3Dy();
builder.buildAxis3Dz();
builder.buildGrid3D();
builder.buildVisualMap();
builder.buildSeries();
return builder.createChartOption();
}
}

14
src/main/java/com/fr/plugin/sqy/surface/option/modle/ChartOptionProvide.java

@ -0,0 +1,14 @@
package com.fr.plugin.sqy.surface.option.modle;
import com.fr.plugin.sqy.surface.option.ChartOption;
public interface ChartOptionProvide {
public void buildToolTip();
public void buildVisualMap();
public void buildAxis3Dx();
public void buildAxis3Dy();
public void buildAxis3Dz();
public void buildGrid3D();
public void buildSeries();
public ChartOption createChartOption();
}

7
src/main/java/com/fr/plugin/sqy/surface/option/modle/OptionProvider.java

@ -0,0 +1,7 @@
package com.fr.plugin.sqy.surface.option.modle;
import com.fr.json.JSONObject;
public interface OptionProvider {
public JSONObject getJSONObject();
}

67
src/main/java/com/fr/plugin/sqy/surface/pane/ReportDataPane.java

@ -0,0 +1,67 @@
package com.fr.plugin.sqy.surface.pane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.extended.chart.AbstractExtendedChartReportDataPane;
import com.fr.plugin.sqy.surface.chart.ChartDataConfig;
import java.awt.*;
public class ReportDataPane extends AbstractExtendedChartReportDataPane<ChartDataConfig> {
private TinyFormulaPane xPane;
private TinyFormulaPane yPane;
@Override
protected boolean hasCustomFieldPane() {
return true;
}
@Override
protected String[] fieldLabel() {
return new String[]{
"X轴",
"Y轴"
};
}
@Override
protected Component[] fieldComponents() {
if (xPane == null) {
xPane = new TinyFormulaPane();
yPane = new TinyFormulaPane();
}
return new Component[]{
xPane,
yPane
};
}
@Override
protected TinyFormulaPane[] formulaPanes() {
if (xPane == null) {
xPane = new TinyFormulaPane();
yPane = new TinyFormulaPane();
}
return new TinyFormulaPane[]{
xPane,
yPane
};
}
@Override
protected void populate(ChartDataConfig chartDataConfig) {
populateField(xPane, chartDataConfig.getX());
populateField(yPane, chartDataConfig.getY());
}
@Override
protected ChartDataConfig update() {
ChartDataConfig dataConfig = new ChartDataConfig();
updateField(xPane, dataConfig.getX());
updateField(yPane, dataConfig.getY());
return dataConfig;
}
}

31
src/main/java/com/fr/plugin/sqy/surface/pane/StylePane.java

@ -0,0 +1,31 @@
package com.fr.plugin.sqy.surface.pane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.extended.chart.AbstractExtendedStylePane;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.plugin.sqy.surface.chart.Chart;
import com.fr.plugin.sqy.surface.pane.style.VisualPane;
import com.fr.plugin.sqy.surface.pane.style.Axis3DXPane;
import com.fr.plugin.sqy.surface.pane.style.Axis3DYPane;
import com.fr.plugin.sqy.surface.pane.style.Axis3DZPane;
import java.util.ArrayList;
import java.util.List;
public class StylePane extends AbstractExtendedStylePane<Chart> {
public StylePane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected List<ExtendedScrollPane<Chart>> initPaneList() {
List<ExtendedScrollPane<Chart>> list = new ArrayList<ExtendedScrollPane<Chart>>();
list.add(new VisualPane());
list.add(new Axis3DXPane());
list.add(new Axis3DYPane());
list.add(new Axis3DZPane());
return list;
}
}

66
src/main/java/com/fr/plugin/sqy/surface/pane/TableDataPane.java

@ -0,0 +1,66 @@
package com.fr.plugin.sqy.surface.pane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.extended.chart.AbstractExtendedChartTableDataPane;
import com.fr.extended.chart.ExtendedCustomFieldComboBoxPane;
import com.fr.plugin.sqy.surface.chart.ChartDataConfig;
import java.awt.*;
public class TableDataPane extends AbstractExtendedChartTableDataPane<ChartDataConfig> {
private UIComboBox xComboBox;
private UIComboBox yComboBox;
@Override
protected ExtendedCustomFieldComboBoxPane createExtendedCustomFieldComboBoxPane() {
return new ExtendedCustomFieldComboBoxPane();
}
@Override
protected String[] fieldLabels() {
return new String[]{
"X轴",
"Y轴"
};
}
@Override
protected Component[] fieldComponents() {
if (xComboBox == null) {
xComboBox = new UIComboBox();
yComboBox = new UIComboBox();
}
return new Component[]{
xComboBox,
yComboBox
};
}
@Override
protected UIComboBox[] filedComboBoxes() {
if (xComboBox == null) {
xComboBox = new UIComboBox();
yComboBox = new UIComboBox();
}
return new UIComboBox[]{
xComboBox,
yComboBox
};
}
@Override
protected void populate(ChartDataConfig chartDataConfig) {
populateField(xComboBox, chartDataConfig.getX());
populateField(yComboBox, chartDataConfig.getY());
}
@Override
protected ChartDataConfig update() {
ChartDataConfig dataConfig = new ChartDataConfig();
updateField(xComboBox, dataConfig.getX());
updateField(yComboBox, dataConfig.getY());
return dataConfig;
}
}

49
src/main/java/com/fr/plugin/sqy/surface/pane/TypePane.java

@ -0,0 +1,49 @@
package com.fr.plugin.sqy.surface.pane;
import com.fr.extended.chart.ExtendedTypePane;
import com.fr.plugin.sqy.surface.chart.Chart;
import com.fr.plugin.sqy.surface.chart.ChartType;
import javax.swing.*;
import java.awt.*;
public class TypePane extends ExtendedTypePane<Chart> {
@Override
protected String[] getTypeIconPath() {
return new String[]{
"com/fr/plugin/sqy/surface/img/type1.png"
};
}
@Override
protected String[] getTypeTipName() {
return new String[]{
"曲面图"
};
}
@Override
protected int getTypeIndex(Chart surfaceChart) {
return surfaceChart.getChartType().ordinal();
}
@Override
protected void setType(Chart surfaceChart, int i) {
surfaceChart.setChartType(ChartType.parseInt(i));
}
@Override
protected Component[][] getPaneComponents(JPanel jPanel) {
return super.getPaneComponents(jPanel);
}
@Override
protected void populate(Chart surfaceChart) {
super.populate(surfaceChart);
}
@Override
protected void update(Chart surfaceChart) {
super.update(surfaceChart);
}
}

230
src/main/java/com/fr/plugin/sqy/surface/pane/style/Axis3DXPane.java

@ -0,0 +1,230 @@
package com.fr.plugin.sqy.surface.pane.style;
import com.fanruan.api.design.ui.component.UIDescriptionTextArea;
import com.fanruan.api.design.ui.component.UITextArea;
import com.fanruan.api.design.ui.component.code.UISyntaxTextArea;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.plugin.chart.type.LineType;
import com.fr.plugin.sqy.surface.chart.Chart;
import com.fr.plugin.sqy.surface.config.AxisConfig;
import com.fr.plugin.sqy.surface.config.LabelConfig;
import com.fr.plugin.sqy.surface.config.LineStyleConfig;
import com.fr.plugin.sqy.surface.util.CreatePaneUtils;
import com.fr.plugin.sqy.surface.zenum.AxisTypeEnum;
import com.fr.plugin.sqy.surface.zenum.LineTypeEnum;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.*;
import java.awt.*;
public class Axis3DXPane extends ExtendedScrollPane<Chart> {
private UIButtonGroup titleIsShow;
private TinyFormulaPane title;
private UISpinner titleFontsize;
private ColorSelectBox titleFontColor;
private UIButtonGroup axisLabelIsShow;
private UISpinner axisLabelFontsize;
private ColorSelectBox axisLabelFontColor;
private UITextArea axisFormatter;
private LineTypeComboBox axisLineTypeComboBox;
private UISpinner axisLineWidth;
private ColorSelectBox axisLineColor;
private UIButtonGroup axisTickIsShow;
private LineTypeComboBox splitLineTypeComboBox;
private UISpinner splitLineWidth;
private ColorSelectBox splitLineColor;
private UIComboBox valueType;
private TinyFormulaPane minValue;
private TinyFormulaPane maxValue;
@Override
public void populateBean(Chart ob) {
AxisConfig axisConfigX = ob.getAxisConfigX();
//标题
LabelConfig nameTextStyle = axisConfigX.getNameTextStyle();
this.titleIsShow.setSelectedIndex(nameTextStyle.isShow() ? 0 : 1);
this.title.populateBean(axisConfigX.getName().getContent());
this.titleFontsize.setValue(nameTextStyle.getFontSize() == 0 ? 16 : nameTextStyle.getFontSize());
this.titleFontColor.setSelectObject(nameTextStyle.getColor());
//标签
LabelConfig axisLabel = axisConfigX.getAxisLabel();
this.axisLabelIsShow.setSelectedIndex(axisLabel.isShow() ? 0 : 1);
this.axisLabelFontsize.setValue(axisLabel.getFontSize() == 0 ? 12 : axisLabel.getFontSize());
this.axisLabelFontColor.setSelectObject(axisLabel.getColor());
this.axisFormatter.setText(axisLabel.getFormatter());
//轴线
LineStyleConfig axisLine = axisConfigX.getAxisLine();
this.axisLineTypeComboBox.setSelectedIndex(LineTypeEnum.parseString(axisLine.getType()).ordinal());
this.axisLineWidth.setValue(axisLine.getWidth() == 0 ? 2 : axisLine.getWidth());
this.axisLineColor.setSelectObject(axisLine.getColor());
//刻度线
this.axisTickIsShow.setSelectedIndex(axisConfigX.getAxisTick().isShow() ? 0 : 1);
//网格线
LineStyleConfig splitLine = axisConfigX.getSplitLine();
this.splitLineTypeComboBox.setSelectedIndex(LineTypeEnum.parseString(splitLine.getType()).ordinal());
this.splitLineWidth.setValue(splitLine.getWidth() == 0 ? 1 : splitLine.getWidth());
this.splitLineColor.setSelectObject(splitLine.getColor());
//值定义
this.valueType.setSelectedIndex(StringUtils.isBlank(axisConfigX.getType()) ? 1 : AxisTypeEnum.parseString(axisConfigX.getType()).ordinal());
this.minValue.populateBean(axisConfigX.getMin().getContent());
this.maxValue.populateBean(axisConfigX.getMax().getContent());
}
@Override
public void updateBean(Chart ob) {
//标题
ob.getAxisConfigX().getNameTextStyle().setShow(this.titleIsShow.getSelectedIndex() == 0);
ob.getAxisConfigX().getName().setContent(this.title.updateBean());
ob.getAxisConfigX().getNameTextStyle().setFontSize((int) this.titleFontsize.getValue());
ob.getAxisConfigX().getNameTextStyle().setColor(this.titleFontColor.getSelectObject());
//标签
ob.getAxisConfigX().getAxisLabel().setShow(this.axisLabelIsShow.getSelectedIndex() == 0);
ob.getAxisConfigX().getAxisLabel().setFontSize((int) this.axisLabelFontsize.getValue());
ob.getAxisConfigX().getAxisLabel().setColor(this.axisLabelFontColor.getSelectObject());
ob.getAxisConfigX().getAxisLabel().setFormatter(this.axisFormatter.getText());
//轴线
ob.getAxisConfigX().getAxisLine().setType(LineTypeEnum.parseInt(this.axisLineTypeComboBox.getSelectedIndex()).getName());
ob.getAxisConfigX().getAxisLine().setWidth((int) this.axisLineWidth.getValue());
ob.getAxisConfigX().getAxisLine().setColor(this.axisLineColor.getSelectObject());
//刻度线
ob.getAxisConfigX().getAxisTick().setShow(this.axisTickIsShow.getSelectedIndex() == 0);//网格线
//网格线
ob.getAxisConfigX().getSplitLine().setType(LineTypeEnum.parseInt(this.splitLineTypeComboBox.getSelectedIndex()).getName());
ob.getAxisConfigX().getSplitLine().setWidth((int) this.splitLineWidth.getValue());
ob.getAxisConfigX().getSplitLine().setColor(this.splitLineColor.getSelectObject());
//值定义
ob.getAxisConfigX().setType(AxisTypeEnum.parseInt(this.valueType.getSelectedIndex()).getName());
ob.getAxisConfigX().getMin().setContent(this.minValue.updateBean());
ob.getAxisConfigX().getMax().setContent(this.maxValue.updateBean());
}
private JPanel getValuePane(){
this.valueType = new UIComboBox(new String[]{"数值","类目"});
this.minValue = new TinyFormulaPane();
this.maxValue = new TinyFormulaPane();
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("值类型"), this.valueType}
, {new UILabel("最小值"), this.minValue}
, {new UILabel("最大值"), this.maxValue}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("值定义", contentPane);
return var2;
}
private JPanel getSplitLinePane(){
this.splitLineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID,LineType.DASHED});
this.splitLineWidth = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.splitLineColor = new ColorSelectBox(1);
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("线型"), this.splitLineTypeComboBox}
, {new UILabel("线宽"), this.splitLineWidth}
, {new UILabel("颜色"), this.splitLineColor}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("网格线", contentPane);
return var2;
}
private JPanel getAxisLinePane(){
this.axisLineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID,LineType.DASHED});
this.axisLineWidth = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.axisLineColor = new ColorSelectBox(1);
this.axisTickIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("线型"), this.axisLineTypeComboBox}
, {new UILabel("线宽"), this.axisLineWidth}
, {new UILabel("颜色"), this.axisLineColor}
, {new UILabel("刻度线"), this.axisTickIsShow}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("轴线", contentPane);
return var2;
}
private JPanel getAxisLabelPane(){
this.axisLabelIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
this.axisLabelFontsize = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.axisLabelFontColor = new ColorSelectBox(1);
this.axisFormatter = new UITextArea("return value;");
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("轴标签"), this.axisLabelIsShow}
, {new UILabel("字体大小"), this.axisLabelFontsize}
, {new UILabel("字体颜色"), this.axisLabelFontColor}
, {new UILabel("标签格式化"), this.axisFormatter}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("标签", contentPane);
return var2;
}
private JPanel getTitlePane(){
this.title = new TinyFormulaPane();
this.titleIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
this.titleFontsize = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.titleFontColor = new ColorSelectBox(1);
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("轴标题"), this.titleIsShow}
, {new UILabel("内容"), this.title}
, {new UILabel("字体大小"), this.titleFontsize}
, {new UILabel("字体颜色"), this.titleFontColor}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("标题", contentPane);
return var2;
}
@Override
protected JPanel createContentPane() {
JPanel panel = new JPanel(new BorderLayout());
Component[][] components = {{null}
, {this.getTitlePane()}
, {this.getAxisLabelPane()}
, {this.getAxisLinePane()}
, {this.getSplitLinePane()}
, {this.getValuePane()}
};
panel.add(TableLayoutHelper.createTableLayoutPane(components,1), BorderLayout.CENTER);
return panel;
}
@Override
protected String title4PopupWindow() {
return "X维度";
}
}

230
src/main/java/com/fr/plugin/sqy/surface/pane/style/Axis3DYPane.java

@ -0,0 +1,230 @@
package com.fr.plugin.sqy.surface.pane.style;
import com.fanruan.api.design.ui.component.UITextArea;
import com.fanruan.api.design.ui.component.code.UISyntaxTextArea;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.plugin.chart.type.LineType;
import com.fr.plugin.sqy.surface.chart.Chart;
import com.fr.plugin.sqy.surface.config.AxisConfig;
import com.fr.plugin.sqy.surface.config.LabelConfig;
import com.fr.plugin.sqy.surface.config.LineStyleConfig;
import com.fr.plugin.sqy.surface.util.CreatePaneUtils;
import com.fr.plugin.sqy.surface.zenum.AxisTypeEnum;
import com.fr.plugin.sqy.surface.zenum.LineTypeEnum;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.*;
import java.awt.*;
public class Axis3DYPane extends ExtendedScrollPane<Chart> {
private UIButtonGroup titleIsShow;
private TinyFormulaPane title;
private UISpinner titleFontsize;
private ColorSelectBox titleFontColor;
private UIButtonGroup axisLabelIsShow;
private UISpinner axisLabelFontsize;
private ColorSelectBox axisLabelFontColor;
private UITextArea axisFormatter;
private LineTypeComboBox axisLineTypeComboBox;
private UISpinner axisLineWidth;
private ColorSelectBox axisLineColor;
private UIButtonGroup axisTickIsShow;
private LineTypeComboBox splitLineTypeComboBox;
private UISpinner splitLineWidth;
private ColorSelectBox splitLineColor;
private UIComboBox valueType;
private TinyFormulaPane minValue;
private TinyFormulaPane maxValue;
@Override
public void populateBean(Chart ob) {
AxisConfig axisConfigY = ob.getAxisConfigY();
//标题
LabelConfig nameTextStyle = axisConfigY.getNameTextStyle();
this.titleIsShow.setSelectedIndex(nameTextStyle.isShow() ? 0 : 1);
this.title.populateBean(axisConfigY.getName().getContent());
this.titleFontsize.setValue(nameTextStyle.getFontSize() == 0 ? 16 : nameTextStyle.getFontSize());
this.titleFontColor.setSelectObject(nameTextStyle.getColor());
//标签
LabelConfig axisLabel = axisConfigY.getAxisLabel();
this.axisLabelIsShow.setSelectedIndex(axisLabel.isShow() ? 0 : 1);
this.axisLabelFontsize.setValue(axisLabel.getFontSize() == 0 ? 12 : axisLabel.getFontSize());
this.axisLabelFontColor.setSelectObject(axisLabel.getColor());
this.axisFormatter.setText(axisLabel.getFormatter());
//轴线
LineStyleConfig axisLine = axisConfigY.getAxisLine();
this.axisLineTypeComboBox.setSelectedIndex(LineTypeEnum.parseString(axisLine.getType()).ordinal());
this.axisLineWidth.setValue(axisLine.getWidth() == 0 ? 2 : axisLine.getWidth());
this.axisLineColor.setSelectObject(axisLine.getColor());
//刻度线
this.axisTickIsShow.setSelectedIndex(axisConfigY.getAxisTick().isShow() ? 0 : 1);
//网格线
LineStyleConfig splitLine = axisConfigY.getSplitLine();
this.splitLineTypeComboBox.setSelectedIndex(LineTypeEnum.parseString(splitLine.getType()).ordinal());
this.splitLineWidth.setValue(splitLine.getWidth() == 0 ? 1 : splitLine.getWidth());
this.splitLineColor.setSelectObject(splitLine.getColor());
//值定义
this.valueType.setSelectedIndex(StringUtils.isBlank(axisConfigY.getType()) ? 0 : AxisTypeEnum.parseString(axisConfigY.getType()).ordinal());
this.minValue.populateBean(axisConfigY.getMin().getContent());
this.maxValue.populateBean(axisConfigY.getMax().getContent());
}
@Override
public void updateBean(Chart ob) {
//标题
ob.getAxisConfigY().getNameTextStyle().setShow(this.titleIsShow.getSelectedIndex() == 0);
ob.getAxisConfigY().getName().setContent(this.title.updateBean());
ob.getAxisConfigY().getNameTextStyle().setFontSize((int) this.titleFontsize.getValue());
ob.getAxisConfigY().getNameTextStyle().setColor(this.titleFontColor.getSelectObject());
//标签
ob.getAxisConfigY().getAxisLabel().setShow(this.axisLabelIsShow.getSelectedIndex() == 0);
ob.getAxisConfigY().getAxisLabel().setFontSize((int) this.axisLabelFontsize.getValue());
ob.getAxisConfigY().getAxisLabel().setColor(this.axisLabelFontColor.getSelectObject());
ob.getAxisConfigY().getAxisLabel().setFormatter(this.axisFormatter.getText());
//轴线
ob.getAxisConfigY().getAxisLine().setType(LineTypeEnum.parseInt(this.axisLineTypeComboBox.getSelectedIndex()).getName());
ob.getAxisConfigY().getAxisLine().setWidth((int) this.axisLineWidth.getValue());
ob.getAxisConfigY().getAxisLine().setColor(this.axisLineColor.getSelectObject());
//刻度线
ob.getAxisConfigY().getAxisTick().setShow(this.axisTickIsShow.getSelectedIndex() == 0);//网格线
//网格线
ob.getAxisConfigY().getSplitLine().setType(LineTypeEnum.parseInt(this.splitLineTypeComboBox.getSelectedIndex()).getName());
ob.getAxisConfigY().getSplitLine().setWidth((int) this.splitLineWidth.getValue());
ob.getAxisConfigY().getSplitLine().setColor(this.splitLineColor.getSelectObject());
//值定义
ob.getAxisConfigY().setType(AxisTypeEnum.parseInt(this.valueType.getSelectedIndex()).getName());
ob.getAxisConfigY().getMin().setContent(this.minValue.updateBean());
ob.getAxisConfigY().getMax().setContent(this.maxValue.updateBean());
}
private JPanel getValuePane(){
this.valueType = new UIComboBox(new String[]{"数值","类目"});
this.minValue = new TinyFormulaPane();
this.maxValue = new TinyFormulaPane();
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("值类型"), this.valueType}
, {new UILabel("最小值"), this.minValue}
, {new UILabel("最大值"), this.maxValue}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("值定义", contentPane);
return var2;
}
private JPanel getSplitLinePane(){
this.splitLineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID,LineType.DASHED});
this.splitLineWidth = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.splitLineColor = new ColorSelectBox(1);
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("线型"), this.splitLineTypeComboBox}
, {new UILabel("线宽"), this.splitLineWidth}
, {new UILabel("颜色"), this.splitLineColor}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("网格线", contentPane);
return var2;
}
private JPanel getAxisLinePane(){
this.axisLineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID,LineType.DASHED});
this.axisLineWidth = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.axisLineColor = new ColorSelectBox(1);
this.axisTickIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("线型"), this.axisLineTypeComboBox}
, {new UILabel("线宽"), this.axisLineWidth}
, {new UILabel("颜色"), this.axisLineColor}
, {new UILabel("刻度线"), this.axisTickIsShow}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("轴线", contentPane);
return var2;
}
private JPanel getAxisLabelPane(){
this.axisLabelIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
this.axisLabelFontsize = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.axisLabelFontColor = new ColorSelectBox(1);
this.axisFormatter = new UITextArea("return value;");
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("轴标签"), this.axisLabelIsShow}
, {new UILabel("字体大小"), this.axisLabelFontsize}
, {new UILabel("字体颜色"), this.axisLabelFontColor}
, {new UILabel("标签格式化"), this.axisFormatter}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("标签", contentPane);
return var2;
}
private JPanel getTitlePane(){
this.title = new TinyFormulaPane();
this.titleIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
this.titleFontsize = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.titleFontColor = new ColorSelectBox(1);
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("轴标题"), this.titleIsShow}
, {new UILabel("内容"), this.title}
, {new UILabel("字体大小"), this.titleFontsize}
, {new UILabel("字体颜色"), this.titleFontColor}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("标题", contentPane);
return var2;
}
@Override
protected JPanel createContentPane() {
JPanel panel = new JPanel(new BorderLayout());
Component[][] components = {{null}
, {this.getTitlePane()}
, {this.getAxisLabelPane()}
, {this.getAxisLinePane()}
, {this.getSplitLinePane()}
, {this.getValuePane()}
};
panel.add(TableLayoutHelper.createTableLayoutPane(components,1), BorderLayout.CENTER);
return panel;
}
@Override
protected String title4PopupWindow() {
return "Y维度";
}
}

229
src/main/java/com/fr/plugin/sqy/surface/pane/style/Axis3DZPane.java

@ -0,0 +1,229 @@
package com.fr.plugin.sqy.surface.pane.style;
import com.fanruan.api.design.ui.component.UITextArea;
import com.fanruan.api.design.ui.component.code.UISyntaxTextArea;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.plugin.chart.type.LineType;
import com.fr.plugin.sqy.surface.chart.Chart;
import com.fr.plugin.sqy.surface.config.AxisConfig;
import com.fr.plugin.sqy.surface.config.LabelConfig;
import com.fr.plugin.sqy.surface.config.LineStyleConfig;
import com.fr.plugin.sqy.surface.util.CreatePaneUtils;
import com.fr.plugin.sqy.surface.zenum.AxisTypeEnum;
import com.fr.plugin.sqy.surface.zenum.LineTypeEnum;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import javax.swing.*;
import java.awt.*;
public class Axis3DZPane extends ExtendedScrollPane<Chart> {
private UIButtonGroup titleIsShow;
private TinyFormulaPane title;
private UISpinner titleFontsize;
private ColorSelectBox titleFontColor;
private UIButtonGroup axisLabelIsShow;
private UISpinner axisLabelFontsize;
private ColorSelectBox axisLabelFontColor;
private UITextArea axisFormatter;
private LineTypeComboBox axisLineTypeComboBox;
private UISpinner axisLineWidth;
private ColorSelectBox axisLineColor;
private UIButtonGroup axisTickIsShow;
private LineTypeComboBox splitLineTypeComboBox;
private UISpinner splitLineWidth;
private ColorSelectBox splitLineColor;
private UIComboBox valueType;
private TinyFormulaPane minValue;
private TinyFormulaPane maxValue;
@Override
public void populateBean(Chart ob) {
AxisConfig axisConfigZ = ob.getAxisConfigZ();
//标题
LabelConfig nameTextStyle = axisConfigZ.getNameTextStyle();
this.titleIsShow.setSelectedIndex(nameTextStyle.isShow() ? 0 : 1);
this.title.populateBean(axisConfigZ.getName().getContent());
this.titleFontsize.setValue(nameTextStyle.getFontSize() == 0 ? 16 : nameTextStyle.getFontSize());
this.titleFontColor.setSelectObject(nameTextStyle.getColor());
//标签
LabelConfig axisLabel = axisConfigZ.getAxisLabel();
this.axisLabelIsShow.setSelectedIndex(axisLabel.isShow() ? 0 : 1);
this.axisLabelFontsize.setValue(axisLabel.getFontSize() == 0 ? 12 : axisLabel.getFontSize());
this.axisLabelFontColor.setSelectObject(axisLabel.getColor());
this.axisFormatter.setText(axisLabel.getFormatter());
//轴线
LineStyleConfig axisLine = axisConfigZ.getAxisLine();
this.axisLineTypeComboBox.setSelectedIndex(LineTypeEnum.parseString(axisLine.getType()).ordinal());
this.axisLineWidth.setValue(axisLine.getWidth() == 0 ? 2 : axisLine.getWidth());
this.axisLineColor.setSelectObject(axisLine.getColor());
//刻度线
this.axisTickIsShow.setSelectedIndex(axisConfigZ.getAxisTick().isShow() ? 0 : 1);
//网格线
LineStyleConfig splitLine = axisConfigZ.getSplitLine();
this.splitLineTypeComboBox.setSelectedIndex(LineTypeEnum.parseString(splitLine.getType()).ordinal());
this.splitLineWidth.setValue(splitLine.getWidth() == 0 ? 1 : splitLine.getWidth());
this.splitLineColor.setSelectObject(splitLine.getColor());
//值定义
this.valueType.setSelectedIndex(StringUtils.isBlank(axisConfigZ.getType()) ? 0 : AxisTypeEnum.parseString(axisConfigZ.getType()).ordinal());
this.minValue.populateBean(axisConfigZ.getMin().getContent());
this.maxValue.populateBean(axisConfigZ.getMax().getContent());
}
@Override
public void updateBean(Chart ob) {
//标题
ob.getAxisConfigZ().getNameTextStyle().setShow(this.titleIsShow.getSelectedIndex() == 0);
ob.getAxisConfigZ().getName().setContent(this.title.updateBean());
ob.getAxisConfigZ().getNameTextStyle().setFontSize((int) this.titleFontsize.getValue());
ob.getAxisConfigZ().getNameTextStyle().setColor(this.titleFontColor.getSelectObject());
//标签
ob.getAxisConfigZ().getAxisLabel().setShow(this.axisLabelIsShow.getSelectedIndex() == 0);
ob.getAxisConfigZ().getAxisLabel().setFontSize((int) this.axisLabelFontsize.getValue());
ob.getAxisConfigZ().getAxisLabel().setColor(this.axisLabelFontColor.getSelectObject());
ob.getAxisConfigZ().getAxisLabel().setFormatter(this.axisFormatter.getText());
//轴线
ob.getAxisConfigZ().getAxisLine().setType(LineTypeEnum.parseInt(this.axisLineTypeComboBox.getSelectedIndex()).getName());
ob.getAxisConfigZ().getAxisLine().setWidth((int) this.axisLineWidth.getValue());
ob.getAxisConfigZ().getAxisLine().setColor(this.axisLineColor.getSelectObject());
//刻度线
ob.getAxisConfigZ().getAxisTick().setShow(this.axisTickIsShow.getSelectedIndex() == 0);//网格线
//网格线
ob.getAxisConfigZ().getSplitLine().setType(LineTypeEnum.parseInt(this.splitLineTypeComboBox.getSelectedIndex()).getName());
ob.getAxisConfigZ().getSplitLine().setWidth((int) this.splitLineWidth.getValue());
ob.getAxisConfigZ().getSplitLine().setColor(this.splitLineColor.getSelectObject());
//值定义
ob.getAxisConfigZ().setType(AxisTypeEnum.parseInt(this.valueType.getSelectedIndex()).getName());
ob.getAxisConfigZ().getMin().setContent(this.minValue.updateBean());
ob.getAxisConfigZ().getMax().setContent(this.maxValue.updateBean());
}
private JPanel getValuePane(){
this.valueType = new UIComboBox(new String[]{"数值","类目"});
this.minValue = new TinyFormulaPane();
this.maxValue = new TinyFormulaPane();
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("值类型"), this.valueType}
, {new UILabel("最小值"), this.minValue}
, {new UILabel("最大值"), this.maxValue}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("值定义", contentPane);
return var2;
}
private JPanel getSplitLinePane(){
this.splitLineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID,LineType.DASHED});
this.splitLineWidth = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.splitLineColor = new ColorSelectBox(1);
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("线型"), this.splitLineTypeComboBox}
, {new UILabel("线宽"), this.splitLineWidth}
, {new UILabel("颜色"), this.splitLineColor}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("网格线", contentPane);
return var2;
}
private JPanel getAxisLinePane(){
this.axisLineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID,LineType.DASHED});
this.axisLineWidth = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.axisLineColor = new ColorSelectBox(1);
this.axisTickIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("线型"), this.axisLineTypeComboBox}
, {new UILabel("线宽"), this.axisLineWidth}
, {new UILabel("颜色"), this.axisLineColor}
, {new UILabel("刻度线"), this.axisTickIsShow}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("轴线", contentPane);
return var2;
}
private JPanel getAxisLabelPane(){
this.axisLabelIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
this.axisLabelFontsize = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.axisLabelFontColor = new ColorSelectBox(1);
this.axisFormatter = new UITextArea("3,3");
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("轴标签"), this.axisLabelIsShow}
, {new UILabel("字体大小"), this.axisLabelFontsize}
, {new UILabel("字体颜色"), this.axisLabelFontColor}
, {new UILabel("标签格式化"), this.axisFormatter}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("标签", contentPane);
return var2;
}
private JPanel getTitlePane(){
this.title = new TinyFormulaPane();
this.titleIsShow = new UIButtonGroup(new String[]{"显示","隐藏"});
this.titleFontsize = new UISpinnerWithPx(1D, 2.147483647E9D, 1D, 1D);
this.titleFontColor = new ColorSelectBox(1);
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("轴标题"), this.titleIsShow}
, {new UILabel("内容"), this.title}
, {new UILabel("字体大小"), this.titleFontsize}
, {new UILabel("字体颜色"), this.titleFontColor}
});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("标题", contentPane);
return var2;
}
@Override
protected JPanel createContentPane() {
JPanel panel = new JPanel(new BorderLayout());
Component[][] components = {{null}
, {this.getTitlePane()}
, {this.getAxisLabelPane()}
, {this.getAxisLinePane()}
, {this.getSplitLinePane()}
, {this.getValuePane()}
};
panel.add(TableLayoutHelper.createTableLayoutPane(components,1), BorderLayout.CENTER);
return panel;
}
@Override
protected String title4PopupWindow() {
return "Z维度";
}
}

116
src/main/java/com/fr/plugin/sqy/surface/pane/style/VisualPane.java

@ -0,0 +1,116 @@
package com.fr.plugin.sqy.surface.pane.style;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.ispinner.chart.UISpinnerWithPx;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.extended.chart.ExtendedScrollPane;
import com.fr.plugin.chart.type.LineType;
import com.fr.plugin.sqy.surface.chart.Chart;
import com.fr.plugin.sqy.surface.config.LineStyleConfig;
import com.fr.plugin.sqy.surface.option.VisualMap;
import com.fr.plugin.sqy.surface.util.CreatePaneUtils;
import com.fr.plugin.sqy.surface.zenum.LineTypeEnum;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.LineTypeComboBox;
import com.fr.van.chart.designer.component.VanChartFillStylePane;
import javax.swing.*;
import java.awt.*;
public class VisualPane extends ExtendedScrollPane<Chart> {
private VanChartFillStylePane vanChartFillStylePane;
private TinyFormulaPane visualMin;
private TinyFormulaPane visualMax;
private LineTypeComboBox lineTypeComboBox;
private UISpinner lineWidthSpinner;
private ColorSelectBox colorButton;
@Override
public void populateBean(Chart ob) {
if(ob.getColorFillStyle().getColorStyle() == 0 || ob.getColorFillStyle().getColorStyle() == 2){
ob.getColorFillStyle().setColorStyle(1);
ob.getColorFillStyle().setColorList(VisualMap.InRange.getDefaultColor());
}
this.vanChartFillStylePane.populateBean(ob.getColorFillStyle());
this.visualMin.populateBean(ob.getVisualMin().getContent());
this.visualMax.populateBean(ob.getVisualMax().getContent());
LineStyleConfig lineStyleConfig = ob.getWireFrameConfig();
this.lineTypeComboBox.setSelectedIndex(LineTypeEnum.parseString(lineStyleConfig.getType()).ordinal());
this.lineWidthSpinner.setValue(lineStyleConfig.getWidth());
this.colorButton.setSelectObject(lineStyleConfig.getColor());
}
@Override
public void updateBean(Chart ob) {
if(this.vanChartFillStylePane.updateBean().getColorStyle() == 0 || this.vanChartFillStylePane.updateBean().getColorStyle() == 2){
ob.getColorFillStyle().setColorStyle(1);
ob.getColorFillStyle().setColorList(VisualMap.InRange.getDefaultColor());
}else {
ob.setColorFillStyle(this.vanChartFillStylePane.updateBean());
}
ob.getVisualMin().setContent(this.visualMin.updateBean());
ob.getVisualMax().setContent(this.visualMax.updateBean());
ob.getWireFrameConfig().setType(LineTypeEnum.parseInt(this.lineTypeComboBox.getSelectedIndex()).getName());
ob.getWireFrameConfig().setWidth(this.lineWidthSpinner.getValue());
ob.getWireFrameConfig().setColor(this.colorButton.getSelectObject());
}
private JPanel getColorPane() {
JPanel var1 = new JPanel(new BorderLayout());
this.vanChartFillStylePane = new VanChartFillStylePane();
var1.add(this.vanChartFillStylePane, "Center");
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("曲面颜色(仅能使用自定义)", var1);
var1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
return var2;
}
private JPanel getAreaPane(){
this.visualMin = new TinyFormulaPane();
this.visualMax = new TinyFormulaPane();
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}, {new UILabel("最小值"), this.visualMin}, {new UILabel("最大值"), this.visualMax}});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("视觉范围(Z维度)", contentPane);
return var2;
}
private JPanel getWireframePane(){
this.lineTypeComboBox = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED});
this.lineWidthSpinner = new UISpinnerWithPx(1D, 2.147483647E9D, 0.5D, 2.0D);
this.colorButton = new ColorSelectBox(1);
JPanel contentPane = CreatePaneUtils.createGapTableLayoutPane(new Component[][]{{null, null}
, {new UILabel("线型"), this.lineTypeComboBox}
, {new UILabel("线宽"), this.lineWidthSpinner}
, {new UILabel("颜色"), this.colorButton}});
JPanel var2 = TableLayout4VanChartHelper.createExpandablePaneWithTitle("曲面间隔线", contentPane);
return var2;
}
@Override
protected JPanel createContentPane() {
JPanel panel = new JPanel(new BorderLayout());
Component[][] components = {{null}
, {this.getColorPane()}
, {this.getAreaPane()}
, {this.getWireframePane()}
};
panel.add(TableLayoutHelper.createTableLayoutPane(components,1), BorderLayout.CENTER);
return panel;
}
@Override
protected String title4PopupWindow() {
return "视觉";
}
}

13
src/main/java/com/fr/plugin/sqy/surface/provider/ChartProvider.java

@ -0,0 +1,13 @@
package com.fr.plugin.sqy.surface.provider;
import com.fr.extended.chart.AbstractChart;
import com.fr.extended.chart.AbstractExtentChartProvider;
import com.fr.plugin.sqy.surface.chart.Chart;
public class ChartProvider extends AbstractExtentChartProvider {
@Override
protected AbstractChart createChart() {
return new Chart();
}
}

52
src/main/java/com/fr/plugin/sqy/surface/provider/ChartUIProvider.java

@ -0,0 +1,52 @@
package com.fr.plugin.sqy.surface.provider;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.extended.chart.AbstractExtendedChartTableDataPane;
import com.fr.extended.chart.AbstractExtendedChartUIProvider;
import com.fr.extended.chart.ExtendedOtherPane;
import com.fr.plugin.sqy.surface.pane.ReportDataPane;
import com.fr.plugin.sqy.surface.pane.StylePane;
import com.fr.plugin.sqy.surface.pane.TableDataPane;
import com.fr.plugin.sqy.surface.pane.TypePane;
public class ChartUIProvider extends AbstractExtendedChartUIProvider {
@Override
protected AbstractExtendedChartTableDataPane getTableDataSourcePane() {
return new TableDataPane();
}
@Override
protected AbstractReportDataContentPane getReportDataSourcePane() {
return new ReportDataPane();
}
@Override
public String[] getDemoImagePath() {
return new String[]{
"com/fr/plugin/sqy/surface/img/face.png"
};
}
@Override
public String getIconPath() {
return "com/fr/plugin/sqy/surface/img/icon.png";
}
//类型配置面板
@Override
public AbstractChartTypePane getPlotTypePane() {
return new TypePane();
}
@Override
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener attributeChangeListener) {
return new AbstractChartAttrPane[]{
new StylePane(attributeChangeListener),
new ExtendedOtherPane()
};
}
}

33
src/main/java/com/fr/plugin/sqy/surface/util/CreatePaneUtils.java

@ -0,0 +1,33 @@
package com.fr.plugin.sqy.surface.util;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.*;
import java.awt.*;
public class CreatePaneUtils {
/**
*
* @param contentPaneComponents
* @param w1 x gap
* @param w2 y gap
* @return
*/
public static JPanel createGapTableLayoutPane(Component[][] contentPaneComponents, Double w1, Double w2) {
double var1 = -2.0D;
double var3 = -1.0D;
double var5 = 155.0D;
double[] var7 = new double[]{var3, var5};//列宽
double[] var8 = new double[contentPaneComponents.length];//行高
for (int i = 0; i < var8.length; i++) {
var8[i]=var1;
}
JPanel var9 = TableLayoutHelper.createGapTableLayoutPane(contentPaneComponents, var8, var7, w1, w2);
return var9;
}
public static JPanel createGapTableLayoutPane(Component[][] contentPaneComponents) {
return createGapTableLayoutPane(contentPaneComponents,12.0D, 10.0D);
}
}

17
src/main/java/com/fr/plugin/sqy/surface/util/PluginStringUtils.java

@ -0,0 +1,17 @@
package com.fr.plugin.sqy.surface.util;
import java.awt.*;
import java.util.regex.Pattern;
public class PluginStringUtils {
private static Pattern numberPattern = Pattern.compile("-?[0-9]+(.[0-9]+)?");
public static boolean isNumber(String str){
return numberPattern.matcher(str).matches();
}
public static String colorToString(Color color){
return "#"+Integer.toHexString(color.getRGB()).substring(2);
}
}

18
src/main/java/com/fr/plugin/sqy/surface/zenum/AxisNameLocationEnum.java

@ -0,0 +1,18 @@
package com.fr.plugin.sqy.surface.zenum;
public enum AxisNameLocationEnum {
START("start"),
MIDDLE("middle"),
END("end");
private final String name;
AxisNameLocationEnum(String name) {
this.name = name;
}
public String getName() {
return name;
}
}

39
src/main/java/com/fr/plugin/sqy/surface/zenum/AxisTypeEnum.java

@ -0,0 +1,39 @@
package com.fr.plugin.sqy.surface.zenum;
import com.fr.stable.StringUtils;
public enum AxisTypeEnum {
VALUE("value"),
CATEGORY("category"),
TIME("time"),
LOG("log");
private final String name;
public static AxisTypeEnum parseInt(int index) {
for (AxisTypeEnum type : AxisTypeEnum.values()) {
if (type.ordinal() == index) {
return type;
}
}
return VALUE;
}
public static AxisTypeEnum parseString(String str) {
for (AxisTypeEnum type : AxisTypeEnum.values()) {
if (StringUtils.equals(type.getName(),str)) {
return type;
}
}
return VALUE;
}
AxisTypeEnum(String name) {
this.name = name;
}
public String getName() {
return name;
}
}

39
src/main/java/com/fr/plugin/sqy/surface/zenum/LineTypeEnum.java

@ -0,0 +1,39 @@
package com.fr.plugin.sqy.surface.zenum;
import com.fr.plugin.sqy.surface.chart.ChartType;
import com.fr.stable.StringUtils;
public enum LineTypeEnum {
NONE("none"),
SOLID("solid"),
DASHED("dashed"),
DOTTED("dotted");
private final String name;
LineTypeEnum(String name) {
this.name = name;
}
public static LineTypeEnum parseInt(int index) {
for (LineTypeEnum type : LineTypeEnum.values()) {
if (type.ordinal() == index) {
return type;
}
}
return SOLID;
}
public static LineTypeEnum parseString(String str) {
for (LineTypeEnum type : LineTypeEnum.values()) {
if (StringUtils.equals(type.getName(),str)) {
return type;
}
}
return SOLID;
}
public String getName() {
return name;
}
}

0
src/main/resources/com/fr/plugin/sqy/surface/css/index.css

BIN
src/main/resources/com/fr/plugin/sqy/surface/img/face.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
src/main/resources/com/fr/plugin/sqy/surface/img/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

BIN
src/main/resources/com/fr/plugin/sqy/surface/img/type1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

55833
src/main/resources/com/fr/plugin/sqy/surface/js/echarts-gl.js

File diff suppressed because one or more lines are too long

81523
src/main/resources/com/fr/plugin/sqy/surface/js/echarts.js

File diff suppressed because it is too large Load Diff

65
src/main/resources/com/fr/plugin/sqy/surface/js/index.js

@ -0,0 +1,65 @@
surfaceWrapper = ExtendedChart.extend({
_init: function (dom, option) {
const myChart = echarts.init(dom);
if(option.data.xAxis3D.axisLabel.formatter !== undefined){
let fmt = "(function(value,index){"+option.data.xAxis3D.axisLabel.formatter+"})(value,index)";
option.data.xAxis3D.axisLabel.formatter = function(value,index){return eval(fmt)};
}
if(option.data.yAxis3D.axisLabel.formatter !== undefined){
let fmt = "(function(value,index){"+option.data.yAxis3D.axisLabel.formatter+"})(value,index)";
option.data.yAxis3D.axisLabel.formatter = function(value,index){return eval(fmt)};
}
if(option.data.zAxis3D.axisLabel.formatter !== undefined){
let fmt = "(function(value,index){"+option.data.zAxis3D.axisLabel.formatter+"})(value,index)";
option.data.zAxis3D.axisLabel.formatter = function(value,index){return eval(fmt)};
}
console.log(option.data);
option.data && myChart.setOption(option.data);
myChart.on('click', function (params) {
const links = option.links;
for(let i = 0;i < links.length;i++){
if(links[i].type === "javascript"){
let script = links[i].script;
script = script.substring(1,script.length-1).replace(/\\n/g,"").replace(/\\"/g,"\"");
script = script.replace(/FR.formulaEvaluator\("=X",[^\(\)]*,false\)/g,'FR.formulaEvaluator("=X",'+JSON.stringify(params.value[0])+',false)');
script = script.replace(/FR.formulaEvaluator\("=Y",[^\(\)]*,false\)/g,'FR.formulaEvaluator("=Y",'+JSON.stringify(params.value[1])+',false)');
script = script.replace(/FR.formulaEvaluator\("=Z",[^\(\)]*,false\)/g,'FR.formulaEvaluator("=Z",'+JSON.stringify(params.value[2])+',false)');
script = script.replace(/FR.formulaEvaluator\("=SERIES_NAME",[^\(\)]*,false\)/g,'FR.formulaEvaluator("=SERIES_NAME",'+JSON.stringify(params.seriesName)+',false)');
eval(script);
}
}
});
return myChart;
},
_refresh: function (chart, option) {
if(option.data.xAxis3D.axisLabel.formatter !== undefined){
let fmt = "(function(value,index){"+option.data.xAxis3D.axisLabel.formatter+"})(value,index)";
option.data.xAxis3D.axisLabel.formatter = function(value,index){return eval(fmt)};
}
if(option.data.yAxis3D.axisLabel.formatter !== undefined){
let fmt = "(function(value,index){"+option.data.yAxis3D.axisLabel.formatter+"})(value,index)";
option.data.yAxis3D.axisLabel.formatter = function(value,index){return eval(fmt)};
}
if(option.data.zAxis3D.axisLabel.formatter !== undefined){
let fmt = "(function(value,index){"+option.data.zAxis3D.axisLabel.formatter+"})(value,index)";
option.data.zAxis3D.axisLabel.formatter = function(value,index){return eval(fmt)};
}
console.log(option.data);
option.data && chart.setOption(option.data);
},
_resize: function (chart) {
chart.resize();
},
_exportInit:function (dom, option) {
option.animation = false;
return this._init(dom, option.data);
},
_exportImage: function (chart) {
return chart.getConnectedDataURL({type: 'png'})
}
});
Loading…
Cancel
Save