|
|
|
@ -1,9 +1,8 @@
|
|
|
|
|
package com.fr.plugin.demo; |
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
|
import com.fr.extended.chart.AbstractChart; |
|
|
|
|
import com.fr.extended.chart.ExtendedHelper; |
|
|
|
|
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.JSExportProcessor; |
|
|
|
|
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 NAME = "DEMO图表"; |
|
|
|
|
|
|
|
|
|
private BaseFormula titleFormula; |
|
|
|
|
private StringFormula titleFormula = new StringFormula(); |
|
|
|
|
|
|
|
|
|
private ThemeType themeType = ThemeType.DARK; |
|
|
|
|
|
|
|
|
@ -53,11 +52,11 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
|
|
|
|
|
this.themeType = themeType; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public BaseFormula getTitleFormula() { |
|
|
|
|
public StringFormula getTitleFormula() { |
|
|
|
|
return titleFormula; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setTitleFormula(BaseFormula titleFormula) { |
|
|
|
|
public void setTitleFormula(StringFormula titleFormula) { |
|
|
|
|
this.titleFormula = titleFormula; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -66,7 +65,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
|
|
|
|
|
super.readAttr(reader); |
|
|
|
|
this.setThemeType(ThemeType.parseInt(reader.getAttrAsInt("theme", 0))); |
|
|
|
|
this.setThreeDimensional(reader.getAttrAsBoolean("threeD", false)); |
|
|
|
|
this.setTitleFormula(ExtendedHelper.readFormula(reader, "title")); |
|
|
|
|
this.getTitleFormula().readAttr("title", reader); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -74,7 +73,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
|
|
|
|
|
super.writeAttr(writer); |
|
|
|
|
writer.attr("theme", getThemeType().ordinal()); |
|
|
|
|
writer.attr("threeD", isThreeDimensional()); |
|
|
|
|
ExtendedHelper.writeFormula(this.getTitleFormula(), writer, "title"); |
|
|
|
|
this.getTitleFormula().writeAttr("title", writer); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -123,7 +122,7 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
|
|
|
|
|
protected void addJSON(DemoDataConfig dataConfig, JSONObject jsonObject, Repository repo) throws JSONException { |
|
|
|
|
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); |
|
|
|
|
|
|
|
|
@ -229,8 +228,8 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected List<BaseFormula> formulas() { |
|
|
|
|
List<BaseFormula> list = new ArrayList<BaseFormula>(); |
|
|
|
|
protected List<StringFormula> formulas() { |
|
|
|
|
List<StringFormula> list = new ArrayList<StringFormula>(); |
|
|
|
|
list.add(this.getTitleFormula()); |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|