|
|
@ -1,9 +1,8 @@ |
|
|
|
package com.fr.plugin.demo; |
|
|
|
package com.fr.plugin.demo; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
|
|
|
|
import com.fr.extended.chart.AbstractChart; |
|
|
|
import com.fr.extended.chart.AbstractChart; |
|
|
|
import com.fr.extended.chart.ExtendedHelper; |
|
|
|
|
|
|
|
import com.fr.extended.chart.HyperLinkPara; |
|
|
|
import com.fr.extended.chart.HyperLinkPara; |
|
|
|
|
|
|
|
import com.fr.extended.chart.StringFormula; |
|
|
|
import com.fr.extended.chart.export.ExportProcessor; |
|
|
|
import com.fr.extended.chart.export.ExportProcessor; |
|
|
|
import com.fr.extended.chart.export.JSExportProcessor; |
|
|
|
import com.fr.extended.chart.export.JSExportProcessor; |
|
|
|
import com.fr.general.GeneralUtils; |
|
|
|
import com.fr.general.GeneralUtils; |
|
|
@ -31,7 +30,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{ |
|
|
|
private static final String ID = "DEMO_CHART"; |
|
|
|
private static final String ID = "DEMO_CHART"; |
|
|
|
private static final String NAME = "DEMO图表"; |
|
|
|
private static final String NAME = "DEMO图表"; |
|
|
|
|
|
|
|
|
|
|
|
private BaseFormula titleFormula; |
|
|
|
private StringFormula titleFormula = new StringFormula(); |
|
|
|
|
|
|
|
|
|
|
|
private ThemeType themeType = ThemeType.DARK; |
|
|
|
private ThemeType themeType = ThemeType.DARK; |
|
|
|
|
|
|
|
|
|
|
@ -53,11 +52,11 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{ |
|
|
|
this.themeType = themeType; |
|
|
|
this.themeType = themeType; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public BaseFormula getTitleFormula() { |
|
|
|
public StringFormula getTitleFormula() { |
|
|
|
return titleFormula; |
|
|
|
return titleFormula; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setTitleFormula(BaseFormula titleFormula) { |
|
|
|
public void setTitleFormula(StringFormula titleFormula) { |
|
|
|
this.titleFormula = titleFormula; |
|
|
|
this.titleFormula = titleFormula; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -66,7 +65,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{ |
|
|
|
super.readAttr(reader); |
|
|
|
super.readAttr(reader); |
|
|
|
this.setThemeType(ThemeType.parseInt(reader.getAttrAsInt("theme", 0))); |
|
|
|
this.setThemeType(ThemeType.parseInt(reader.getAttrAsInt("theme", 0))); |
|
|
|
this.setThreeDimensional(reader.getAttrAsBoolean("threeD", false)); |
|
|
|
this.setThreeDimensional(reader.getAttrAsBoolean("threeD", false)); |
|
|
|
this.setTitleFormula(ExtendedHelper.readFormula(reader, "title")); |
|
|
|
this.getTitleFormula().readAttr("title", reader); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -74,7 +73,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{ |
|
|
|
super.writeAttr(writer); |
|
|
|
super.writeAttr(writer); |
|
|
|
writer.attr("theme", getThemeType().ordinal()); |
|
|
|
writer.attr("theme", getThemeType().ordinal()); |
|
|
|
writer.attr("threeD", isThreeDimensional()); |
|
|
|
writer.attr("threeD", isThreeDimensional()); |
|
|
|
ExtendedHelper.writeFormula(this.getTitleFormula(), writer, "title"); |
|
|
|
this.getTitleFormula().writeAttr("title", writer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -123,7 +122,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{ |
|
|
|
protected void addJSON(DemoDataConfig dataConfig, JSONObject jsonObject, Repository repo) throws JSONException { |
|
|
|
protected void addJSON(DemoDataConfig dataConfig, JSONObject jsonObject, Repository repo) throws JSONException { |
|
|
|
jsonObject.put("theme", getThemeType() == ThemeType.DARK ? "dark" : "sth whatever"); |
|
|
|
jsonObject.put("theme", getThemeType() == ThemeType.DARK ? "dark" : "sth whatever"); |
|
|
|
|
|
|
|
|
|
|
|
jsonObject.put("title", JSONFactory.createJSON(JSON.OBJECT).put("text", ExtendedHelper.getFormulaResult(titleFormula))); |
|
|
|
jsonObject.put("title", JSONFactory.createJSON(JSON.OBJECT).put("text", getTitleFormula().getResult())); |
|
|
|
|
|
|
|
|
|
|
|
JSONArray array = JSONFactory.createJSON(JSON.ARRAY); |
|
|
|
JSONArray array = JSONFactory.createJSON(JSON.ARRAY); |
|
|
|
|
|
|
|
|
|
|
@ -229,8 +228,8 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected List<BaseFormula> formulas() { |
|
|
|
protected List<StringFormula> formulas() { |
|
|
|
List<BaseFormula> list = new ArrayList<BaseFormula>(); |
|
|
|
List<StringFormula> list = new ArrayList<StringFormula>(); |
|
|
|
list.add(this.getTitleFormula()); |
|
|
|
list.add(this.getTitleFormula()); |
|
|
|
return list; |
|
|
|
return list; |
|
|
|
} |
|
|
|
} |
|
|
|