diff --git a/plugin.xml b/plugin.xml
index a219150..e696365 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,13 +3,15 @@
com.fr.solution.plugin.chart.echarts
yes
- 1.1
+ 2.0
8.0
2016-01-11
solution
[2016-01-01]中国地图
+ [2016-02-18]饼图
+
]]>
@@ -19,11 +21,15 @@
+
+
diff --git a/src/com/fr/solution/plugin/chart/echarts/ChineseMap.java b/src/com/fr/solution/plugin/chart/echarts/ChineseMap.java
index 6f012f3..36dea10 100644
--- a/src/com/fr/solution/plugin/chart/echarts/ChineseMap.java
+++ b/src/com/fr/solution/plugin/chart/echarts/ChineseMap.java
@@ -3,20 +3,20 @@ package com.fr.solution.plugin.chart.echarts;
import com.fr.chart.chartattr.Chart;
import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.base.AbstractIndependentEChartsProvider;
-import com.fr.solution.plugin.chart.echarts.base.NewChart;
-import com.fr.solution.plugin.chart.echarts.core.map.ChineseMapPlot;
+import com.fr.solution.plugin.chart.echarts.base.ECharts;
+import com.fr.solution.plugin.chart.echarts.plot.map.ChineseMapPlot;
/**
* Created by richie on 16/1/29.
*/
public class ChineseMap extends AbstractIndependentEChartsProvider {
- private static NewChart createChineseMap() {
+ private static ECharts createChineseMap() {
ChineseMapPlot plot = new ChineseMapPlot();
- return new NewChart(plot);
+ return new ECharts(plot);
}
- public static NewChart[] charts = new NewChart[] {
+ public static ECharts[] charts = new ECharts[] {
createChineseMap()
};
@@ -41,9 +41,4 @@ public class ChineseMap extends AbstractIndependentEChartsProvider {
return "com/fr/solution/plugin/chart/echarts/images/map/map256.png";
}
- @Override
- public String getWrapperName() {
- return "EChartsFactory";
- }
-
}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/ChineseMapUI.java b/src/com/fr/solution/plugin/chart/echarts/ChineseMapUI.java
index cdfd266..64f1964 100644
--- a/src/com/fr/solution/plugin/chart/echarts/ChineseMapUI.java
+++ b/src/com/fr/solution/plugin/chart/echarts/ChineseMapUI.java
@@ -6,6 +6,7 @@ import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
+import com.fr.solution.plugin.chart.echarts.ui.AbstractIndependentEChartsUI;
import com.fr.solution.plugin.chart.echarts.ui.map.ChineseMapReportDataContentPane;
import com.fr.solution.plugin.chart.echarts.ui.map.ChineseMapTableDataContentPane;
import com.fr.solution.plugin.chart.echarts.ui.map.ChineseChartTypePane;
@@ -13,7 +14,7 @@ import com.fr.solution.plugin.chart.echarts.ui.map.ChineseChartTypePane;
/**
* Created by richie on 16/1/29.
*/
-public class ChineseMapUI extends AbstractIndependentChartUI {
+public class ChineseMapUI extends AbstractIndependentEChartsUI {
@Override
public AbstractChartTypePane getPlotTypePane() {
return new ChineseChartTypePane();
@@ -33,9 +34,4 @@ public class ChineseMapUI extends AbstractIndependentChartUI {
public String getIconPath() {
return "com/fr/solution/plugin/chart/echarts/images/map/chinese.png";
}
-
- @Override
- public boolean isUseDefaultPane() {
- return false;
- }
}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/EChartsPie.java b/src/com/fr/solution/plugin/chart/echarts/EChartsPie.java
new file mode 100644
index 0000000..a337b21
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/EChartsPie.java
@@ -0,0 +1,45 @@
+package com.fr.solution.plugin.chart.echarts;
+
+import com.fr.chart.chartattr.Chart;
+import com.fr.general.Inter;
+import com.fr.solution.plugin.chart.echarts.base.AbstractIndependentEChartsProvider;
+import com.fr.solution.plugin.chart.echarts.base.ECharts;
+import com.fr.solution.plugin.chart.echarts.plot.pie.EChartsPiePlot;
+import com.fr.solution.plugin.chart.echarts.plot.pie.PieType;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class EChartsPie extends AbstractIndependentEChartsProvider {
+
+ private static ECharts createPie(PieType type) {
+ EChartsPiePlot plot = new EChartsPiePlot(type);
+ return new ECharts(plot);
+ }
+
+ public static ECharts[] charts = new ECharts[] {
+ createPie(PieType.REGULAR),
+ createPie(PieType.CIRCLE)
+ };
+
+
+ @Override
+ public String getChartName() {
+ return "Plugin-ECharts_Pie";
+ }
+
+ @Override
+ public String getChartUseName() {
+ return Inter.getLocText("Plugin-ECharts_Pie");
+ }
+
+ @Override
+ public Chart[] getChartTypes() {
+ return charts;
+ }
+
+ @Override
+ public String getChartImagePath() {
+ return "com/fr/solution/plugin/chart/echarts/images/pie/pie256.png";
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/EChartsPieUI.java b/src/com/fr/solution/plugin/chart/echarts/EChartsPieUI.java
new file mode 100644
index 0000000..d9ebabe
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/EChartsPieUI.java
@@ -0,0 +1,37 @@
+package com.fr.solution.plugin.chart.echarts;
+
+import com.fr.chart.chartattr.Plot;
+import com.fr.design.mainframe.chart.gui.ChartDataPane;
+import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
+import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
+import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
+import com.fr.solution.plugin.chart.echarts.ui.AbstractIndependentEChartsUI;
+import com.fr.solution.plugin.chart.echarts.ui.pie.EChartsPieChartTypePane;
+import com.fr.solution.plugin.chart.echarts.ui.pie.EChartsPieReportDataContentPane;
+import com.fr.solution.plugin.chart.echarts.ui.pie.EChartsPieTableDataContentPane;
+
+/**
+ * Created by richie on 16/1/29.
+ */
+public class EChartsPieUI extends AbstractIndependentEChartsUI {
+
+ @Override
+ public AbstractChartTypePane getPlotTypePane() {
+ return new EChartsPieChartTypePane();
+ }
+
+ @Override
+ public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
+ return new EChartsPieTableDataContentPane(parent);
+ }
+
+ @Override
+ public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
+ return new EChartsPieReportDataContentPane();
+ }
+
+ @Override
+ public String getIconPath() {
+ return "com/fr/solution/plugin/chart/echarts/images/pie/pie.png";
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/base/AbstractIndependentEChartsProvider.java b/src/com/fr/solution/plugin/chart/echarts/base/AbstractIndependentEChartsProvider.java
index 7118194..631f615 100644
--- a/src/com/fr/solution/plugin/chart/echarts/base/AbstractIndependentEChartsProvider.java
+++ b/src/com/fr/solution/plugin/chart/echarts/base/AbstractIndependentEChartsProvider.java
@@ -13,4 +13,9 @@ public abstract class AbstractIndependentEChartsProvider extends AbstractIndepen
"/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js"
};
}
+
+ @Override
+ public String getWrapperName() {
+ return "EChartsFactory";
+ }
}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/base/NewChart.java b/src/com/fr/solution/plugin/chart/echarts/base/ECharts.java
similarity index 57%
rename from src/com/fr/solution/plugin/chart/echarts/base/NewChart.java
rename to src/com/fr/solution/plugin/chart/echarts/base/ECharts.java
index 3436439..c138d87 100644
--- a/src/com/fr/solution/plugin/chart/echarts/base/NewChart.java
+++ b/src/com/fr/solution/plugin/chart/echarts/base/ECharts.java
@@ -7,44 +7,44 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.general.ComparatorUtils;
import com.fr.general.xml.GeneralXMLTools;
-import com.fr.solution.plugin.chart.echarts.glyph.NewGlyph;
-import com.fr.solution.plugin.chart.echarts.glyph.NewLegendGlyph;
-import com.fr.solution.plugin.chart.echarts.glyph.NewTitleGlyph;
-import com.fr.solution.plugin.chart.echarts.plot.NewPlot;
-import com.fr.solution.plugin.chart.echarts.title.NewTitle;
-import com.fr.stable.xml.XMLReadable;
+import com.fr.solution.plugin.chart.echarts.glyph.EChartsGlyph;
+import com.fr.solution.plugin.chart.echarts.glyph.EChartsLegendGlyph;
+import com.fr.solution.plugin.chart.echarts.glyph.EChartsTitleGlyph;
+import com.fr.solution.plugin.chart.echarts.plot.EChartsPlot;
+import com.fr.solution.plugin.chart.echarts.title.EChartsTitle;
import com.fr.stable.xml.XMLableReader;
/**
* Created by richie on 16/1/29.
*/
-public class NewChart extends Chart {
+public class ECharts extends Chart {
- public NewChart() {
+ public ECharts() {
setWrapperName("EChartsFactory");
- setTitle(new NewTitle());
+ setTitle(new EChartsTitle());
}
- public NewChart(NewPlot plot) {
+ public ECharts(EChartsPlot plot) {
super(plot);
setWrapperName("EChartsFactory");
- setTitle(new NewTitle());
+ setTitle(new EChartsTitle());
}
@Override
public BaseChartGlyph createGlyph(ChartData chartData) {
- NewGlyph glyph = new NewGlyph();
+ EChartsGlyph glyph = new EChartsGlyph();
glyph.setGeneralInfo(this);
- NewPlot newPlot = (NewPlot) getPlot();
- if (newPlot != null) {
- PlotGlyph plotGlyph = newPlot.createPlotGlyph(chartData);
- NewLegendGlyph legendGlyph = newPlot.createLegendGlyph(plotGlyph);
+ EChartsPlot EChartsPlot = (EChartsPlot) getPlot();
+ if (EChartsPlot != null) {
+ PlotGlyph plotGlyph = EChartsPlot.createPlotGlyph(chartData);
+ glyph.setPlotGlyph(plotGlyph);
+ EChartsLegendGlyph legendGlyph = EChartsPlot.createLegendGlyph(plotGlyph);
glyph.setLegendGlyph(legendGlyph);
}
- NewTitle title = (NewTitle)getTitle();
+ EChartsTitle title = (EChartsTitle)getTitle();
if (title != null) {
- NewTitleGlyph titleGlyph = title.createGlyph();
+ EChartsTitleGlyph titleGlyph = title.createGlyph();
glyph.setTitleGlyph(titleGlyph);
}
@@ -62,7 +62,7 @@ public class NewChart extends Chart {
* @return 是否是obClass对象
*/
public boolean accept(Class extends Chart> obClass){
- return ComparatorUtils.equals(NewChart.class, obClass);
+ return ComparatorUtils.equals(ECharts.class, obClass);
}
@@ -71,8 +71,8 @@ public class NewChart extends Chart {
if (reader.isChildNode()) {
String tmpNodeName = reader.getTagName();
- if (tmpNodeName.equals(NewTitle.XML_TAG)) {
- setTitle(new NewTitle());
+ if (tmpNodeName.equals(EChartsTitle.XML_TAG)) {
+ setTitle(new EChartsTitle());
reader.readXMLObject(getTitle());
} else if (tmpNodeName.equals(Plot.XML_TAG)) {
setPlot((Plot) GeneralXMLTools.readXMLable(reader));
diff --git a/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlotGlyph.java b/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlotGlyph.java
deleted file mode 100644
index 0430c88..0000000
--- a/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlotGlyph.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.fr.solution.plugin.chart.echarts.core.map;
-
-import com.fr.chart.chartglyph.PlotGlyph;
-
-/**
- * Created by richie on 16/1/29.
- */
-public class ChineseMapPlotGlyph extends PlotGlyph {
- @Override
- public void layoutAxisGlyph(int resolution) {
-
- }
-
- @Override
- public void layoutDataSeriesGlyph(int resolution) {
-
- }
-
- @Override
- public String getPlotGlyphType() {
- return "ChineseMapPlotGlyph";
- }
-
- @Override
- public String getChartType() {
- return "ChineseMap";
- }
-}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsGlyph.java b/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsGlyph.java
new file mode 100644
index 0000000..08406b0
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsGlyph.java
@@ -0,0 +1,50 @@
+package com.fr.solution.plugin.chart.echarts.glyph;
+
+import com.fr.chart.chartglyph.ChartGlyph;
+import com.fr.json.JSONArray;
+import com.fr.json.JSONException;
+import com.fr.json.JSONObject;
+import com.fr.stable.web.Repository;
+
+/**
+ * Created by richie on 16/1/29.
+ */
+public class EChartsGlyph extends ChartGlyph {
+
+ @Override
+ public JSONObject toJSONObject(Repository repo) throws JSONException {
+ JSONObject jo = new JSONObject();
+ EChartsTitleGlyph titleGlyph = (EChartsTitleGlyph) getTitleGlyph();
+ if (titleGlyph != null) {
+ jo.put("title", titleGlyph.toJSONObject(repo));
+ }
+ jo.put("tooltip", createTooltip(repo));
+
+ EChartsLegendGlyph legendGlyph = (EChartsLegendGlyph) getLegendGlyph();
+ if (legendGlyph != null) {
+ jo.put("legend", legendGlyph.toJSONObject(repo));
+ }
+ jo.put("dataRange", createDataRange(repo));
+ EChartsPlotGlyph plotGlyph = (EChartsPlotGlyph) getPlotGlyph();
+ if (plotGlyph != null) {
+ jo.put("series", plotGlyph.toSeriesData(repo));
+ }
+ return jo;
+ }
+
+
+ private JSONObject createTooltip(Repository repo) throws JSONException {
+ return JSONObject.create()
+ .put("trigger", "item");
+ }
+
+
+ private JSONObject createDataRange(Repository repo) throws JSONException {
+ return JSONObject.create()
+ .put("min", 0)
+ .put("max", 2500)
+ .put("x", "left")
+ .put("y", "bottom")
+ .put("text", JSONArray.create().put("高").put("低"));
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/glyph/NewLegendGlyph.java b/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsLegendGlyph.java
similarity index 92%
rename from src/com/fr/solution/plugin/chart/echarts/glyph/NewLegendGlyph.java
rename to src/com/fr/solution/plugin/chart/echarts/glyph/EChartsLegendGlyph.java
index a091729..3d70086 100644
--- a/src/com/fr/solution/plugin/chart/echarts/glyph/NewLegendGlyph.java
+++ b/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsLegendGlyph.java
@@ -9,7 +9,7 @@ import com.fr.stable.web.Repository;
/**
* Created by richie on 16/2/2.
*/
-public class NewLegendGlyph extends LegendGlyph {
+public class EChartsLegendGlyph extends LegendGlyph {
@Override
public JSONObject toJSONObject(Repository repo) throws JSONException {
diff --git a/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsPlotGlyph.java b/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsPlotGlyph.java
new file mode 100644
index 0000000..c94a247
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsPlotGlyph.java
@@ -0,0 +1,30 @@
+package com.fr.solution.plugin.chart.echarts.glyph;
+
+import com.fr.chart.chartglyph.PlotGlyph;
+import com.fr.json.JSONArray;
+import com.fr.json.JSONException;
+import com.fr.json.JSONObject;
+import com.fr.stable.web.Repository;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public abstract class EChartsPlotGlyph extends PlotGlyph {
+
+ @Override
+ public void layoutAxisGlyph(int resolution) {
+
+ }
+
+ @Override
+ public void layoutDataSeriesGlyph(int resolution) {
+
+ }
+
+ @Override
+ public JSONObject toJSONObject(Repository repo) throws JSONException {
+ throw new UnsupportedOperationException("Not support yet!");
+ }
+
+ public abstract JSONArray toSeriesData(Repository repo) throws JSONException;
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/glyph/NewTitleGlyph.java b/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsTitleGlyph.java
similarity index 81%
rename from src/com/fr/solution/plugin/chart/echarts/glyph/NewTitleGlyph.java
rename to src/com/fr/solution/plugin/chart/echarts/glyph/EChartsTitleGlyph.java
index 76df7c1..94a41d1 100644
--- a/src/com/fr/solution/plugin/chart/echarts/glyph/NewTitleGlyph.java
+++ b/src/com/fr/solution/plugin/chart/echarts/glyph/EChartsTitleGlyph.java
@@ -8,13 +8,13 @@ import com.fr.stable.web.Repository;
/**
* Created by richie on 16/2/2.
*/
-public class NewTitleGlyph extends TitleGlyph {
+public class EChartsTitleGlyph extends TitleGlyph {
- public NewTitleGlyph() {
+ public EChartsTitleGlyph() {
}
- public NewTitleGlyph(String title, String subTitle) {
+ public EChartsTitleGlyph(String title, String subTitle) {
}
diff --git a/src/com/fr/solution/plugin/chart/echarts/glyph/NewGlyph.java b/src/com/fr/solution/plugin/chart/echarts/glyph/NewGlyph.java
deleted file mode 100644
index edf89d0..0000000
--- a/src/com/fr/solution/plugin/chart/echarts/glyph/NewGlyph.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package com.fr.solution.plugin.chart.echarts.glyph;
-
-import com.fr.chart.chartglyph.ChartGlyph;
-import com.fr.json.JSONArray;
-import com.fr.json.JSONException;
-import com.fr.json.JSONObject;
-import com.fr.solution.plugin.chart.echarts.glyph.NewLegendGlyph;
-import com.fr.solution.plugin.chart.echarts.glyph.NewTitleGlyph;
-import com.fr.stable.web.Repository;
-
-/**
- * Created by richie on 16/1/29.
- */
-public class NewGlyph extends ChartGlyph {
-
- private NewTitleGlyph titleGlyph;
-
- private NewLegendGlyph legendGlyph;
-
-
- public void setTitleGlyph(NewTitleGlyph titleGlyph) {
- this.titleGlyph = titleGlyph;
- }
-
- @Override
- public NewLegendGlyph getLegendGlyph() {
- return legendGlyph;
- }
-
- public void setLegendGlyph(NewLegendGlyph legendGlyph) {
- this.legendGlyph = legendGlyph;
- }
-
- @Override
- public JSONObject toJSONObject(Repository repo) throws JSONException {
- JSONObject jo = new JSONObject();
- //jo.put("title", createTitle(repo));
- if (titleGlyph != null) {
- jo.put("title", titleGlyph.toJSONObject(repo));
- }
- jo.put("tooltip", createTooltip(repo));
-
-
-// jo.put("legend", createLegend(repo));
-
- if (legendGlyph != null) {
- jo.put("legend", legendGlyph.toJSONObject(repo));
- }
- jo.put("dataRange", createDataRange(repo));
- jo.put("series", createSeries(repo));
- return jo;
- }
-
-
- private JSONObject createTooltip(Repository repo) throws JSONException {
- return JSONObject.create()
- .put("trigger", "item");
- }
-
-
- private JSONObject createDataRange(Repository repo) throws JSONException {
- return JSONObject.create()
- .put("min", 0)
- .put("max", 2500)
- .put("x", "left")
- .put("y", "bottom")
- .put("text", JSONArray.create().put("高").put("低"));
- }
-
- private JSONArray createSeries(Repository repo) throws JSONException {
- JSONArray series = JSONArray.create();
-
- series.put(JSONObject.create()
- .put("name", "iPhone3")
- .put("type", "map")
- .put("mapType", "china")
- .put("itemStyle", createItemStyle(repo))
- .put("data", JSONArray.create().put(JSONObject.create().put("name", "北京").put("value", 20)))
- );
-
- series.put(JSONObject.create()
- .put("name", "iPhone4")
- .put("type", "map")
- .put("mapType", "china")
- .put("itemStyle", createItemStyle(repo))
- .put("data", JSONArray.create().put(JSONObject.create().put("name", "江苏").put("value", 20)))
- );
-
- series.put(JSONObject.create()
- .put("name", "iPhone5")
- .put("type", "map")
- .put("mapType", "china")
- .put("itemStyle", createItemStyle(repo))
- .put("data", JSONArray.create().put(JSONObject.create().put("name", "四川").put("value", 20)))
- );
-
- return series;
- }
-
- private JSONObject createItemStyle(Repository repo) throws JSONException {
- JSONObject itemStyle = JSONObject.create();
- itemStyle.put("normal", JSONObject.create().put("label", JSONObject.create().put("show", true)));
- itemStyle.put("emphasis", JSONObject.create().put("label", JSONObject.create().put("show", true)));
- return itemStyle;
- }
-}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/glyph/NewSeriesGlyph.java b/src/com/fr/solution/plugin/chart/echarts/glyph/NewSeriesGlyph.java
deleted file mode 100644
index 722bac3..0000000
--- a/src/com/fr/solution/plugin/chart/echarts/glyph/NewSeriesGlyph.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.fr.solution.plugin.chart.echarts.glyph;
-
-import com.fr.chart.chartglyph.ChartGlyph;
-
-/**
- * Created by richie on 16/2/2.
- */
-public class NewSeriesGlyph extends ChartGlyph {
-
-}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/glyph/map/ChineseMapPlotGlyph.java b/src/com/fr/solution/plugin/chart/echarts/glyph/map/ChineseMapPlotGlyph.java
new file mode 100644
index 0000000..d09a0f2
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/glyph/map/ChineseMapPlotGlyph.java
@@ -0,0 +1,72 @@
+package com.fr.solution.plugin.chart.echarts.glyph.map;
+
+import com.fr.json.JSONArray;
+import com.fr.json.JSONException;
+import com.fr.json.JSONObject;
+import com.fr.solution.plugin.chart.echarts.glyph.EChartsPlotGlyph;
+import com.fr.stable.web.Repository;
+
+/**
+ * Created by richie on 16/1/29.
+ */
+public class ChineseMapPlotGlyph extends EChartsPlotGlyph {
+ @Override
+ public void layoutAxisGlyph(int resolution) {
+
+ }
+
+ @Override
+ public void layoutDataSeriesGlyph(int resolution) {
+
+ }
+
+ @Override
+ public String getPlotGlyphType() {
+ return "ChineseMapPlotGlyph";
+ }
+
+ @Override
+ public String getChartType() {
+ return "ChineseMap";
+ }
+
+ public JSONArray toSeriesData(Repository repo) throws JSONException {
+ JSONArray series = JSONArray.create();
+
+ series.put(JSONObject.create()
+ .put("name", "iPhone3")
+ .put("type", "map")
+ .put("mapType", "china")
+ .put("itemStyle", createItemStyle(repo))
+ .put("data", JSONArray.create().put(JSONObject.create().put("name", "北京").put("value", 20)))
+ );
+
+ series.put(JSONObject.create()
+ .put("name", "iPhone4")
+ .put("type", "map")
+ .put("mapType", "china")
+ .put("itemStyle", createItemStyle(repo))
+ .put("data", JSONArray.create()
+ .put(JSONObject.create().put("name", "江苏").put("value", 20))
+ .put(JSONObject.create().put("name", "四川").put("value", 300))
+ )
+ );
+
+ series.put(JSONObject.create()
+ .put("name", "iPhone5")
+ .put("type", "map")
+ .put("mapType", "china")
+ .put("itemStyle", createItemStyle(repo))
+ .put("data", JSONArray.create().put(JSONObject.create().put("name", "四川").put("value", 20)))
+ );
+
+ return series;
+ }
+
+ private JSONObject createItemStyle(Repository repo) throws JSONException {
+ JSONObject itemStyle = JSONObject.create();
+ itemStyle.put("normal", JSONObject.create().put("label", JSONObject.create().put("show", true)));
+ itemStyle.put("emphasis", JSONObject.create().put("label", JSONObject.create().put("show", true)));
+ return itemStyle;
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/glyph/pie/EChartsPiePlotGlyph.java b/src/com/fr/solution/plugin/chart/echarts/glyph/pie/EChartsPiePlotGlyph.java
new file mode 100644
index 0000000..7426d89
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/glyph/pie/EChartsPiePlotGlyph.java
@@ -0,0 +1,26 @@
+package com.fr.solution.plugin.chart.echarts.glyph.pie;
+
+import com.fr.json.JSONArray;
+import com.fr.json.JSONException;
+import com.fr.solution.plugin.chart.echarts.glyph.EChartsPlotGlyph;
+import com.fr.stable.web.Repository;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class EChartsPiePlotGlyph extends EChartsPlotGlyph {
+ @Override
+ public String getPlotGlyphType() {
+ return "EChartsPiePlotGlyph";
+ }
+
+ @Override
+ public String getChartType() {
+ return "EChartsPie";
+ }
+
+ public JSONArray toSeriesData(Repository repo) throws JSONException {
+ JSONArray series = JSONArray.create();
+ return series;
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/images/pie/pie.png b/src/com/fr/solution/plugin/chart/echarts/images/pie/pie.png
new file mode 100644
index 0000000..c6c5818
Binary files /dev/null and b/src/com/fr/solution/plugin/chart/echarts/images/pie/pie.png differ
diff --git a/src/com/fr/solution/plugin/chart/echarts/images/pie/pie256.png b/src/com/fr/solution/plugin/chart/echarts/images/pie/pie256.png
new file mode 100644
index 0000000..e69f263
Binary files /dev/null and b/src/com/fr/solution/plugin/chart/echarts/images/pie/pie256.png differ
diff --git a/src/com/fr/solution/plugin/chart/echarts/images/pie/pie_type1.png b/src/com/fr/solution/plugin/chart/echarts/images/pie/pie_type1.png
new file mode 100644
index 0000000..10e2bbe
Binary files /dev/null and b/src/com/fr/solution/plugin/chart/echarts/images/pie/pie_type1.png differ
diff --git a/src/com/fr/solution/plugin/chart/echarts/images/pie/pie_type2.png b/src/com/fr/solution/plugin/chart/echarts/images/pie/pie_type2.png
new file mode 100644
index 0000000..18c5ae8
Binary files /dev/null and b/src/com/fr/solution/plugin/chart/echarts/images/pie/pie_type2.png differ
diff --git a/src/com/fr/solution/plugin/chart/echarts/legend/NewLegend.java b/src/com/fr/solution/plugin/chart/echarts/legend/EChartsLegend.java
similarity index 56%
rename from src/com/fr/solution/plugin/chart/echarts/legend/NewLegend.java
rename to src/com/fr/solution/plugin/chart/echarts/legend/EChartsLegend.java
index 1b16add..4fe9886 100644
--- a/src/com/fr/solution/plugin/chart/echarts/legend/NewLegend.java
+++ b/src/com/fr/solution/plugin/chart/echarts/legend/EChartsLegend.java
@@ -1,17 +1,17 @@
package com.fr.solution.plugin.chart.echarts.legend;
import com.fr.chart.chartattr.Legend;
-import com.fr.solution.plugin.chart.echarts.glyph.NewLegendGlyph;
+import com.fr.solution.plugin.chart.echarts.glyph.EChartsLegendGlyph;
/**
* Created by richie on 16/2/18.
*/
-public class NewLegend extends Legend {
+public class EChartsLegend extends Legend {
- public static final String XML_TAG = "NewLegend";
+ public static final String XML_TAG = "EChartsLegend";
- public NewLegendGlyph createLegendGlyph() {
- NewLegendGlyph resultLegendGlyph = new NewLegendGlyph();
+ public EChartsLegendGlyph createLegendGlyph() {
+ EChartsLegendGlyph resultLegendGlyph = new EChartsLegendGlyph();
resultLegendGlyph.setFont(getFRFont());
resultLegendGlyph.setGeneralInfo(this);
diff --git a/src/com/fr/solution/plugin/chart/echarts/locale/echarts.properties b/src/com/fr/solution/plugin/chart/echarts/locale/echarts.properties
index 29936ac..5128e77 100644
--- a/src/com/fr/solution/plugin/chart/echarts/locale/echarts.properties
+++ b/src/com/fr/solution/plugin/chart/echarts/locale/echarts.properties
@@ -1 +1,2 @@
-Plugin-ECharts_Chinese_Map=Chinese Map
\ No newline at end of file
+Plugin-ECharts_Chinese_Map=Chinese Map
+Plugin-ECharts_Pie=Pie(ECharts)
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/locale/echarts_zh_CN.properties b/src/com/fr/solution/plugin/chart/echarts/locale/echarts_zh_CN.properties
index cbef872..ab2b670 100644
--- a/src/com/fr/solution/plugin/chart/echarts/locale/echarts_zh_CN.properties
+++ b/src/com/fr/solution/plugin/chart/echarts/locale/echarts_zh_CN.properties
@@ -1 +1,2 @@
-Plugin-ECharts_Chinese_Map=\u4E2D\u56FD\u5730\u56FE
\ No newline at end of file
+Plugin-ECharts_Chinese_Map=\u4E2D\u56FD\u5730\u56FE
+Plugin-ECharts_Pie=\u997C\u56FE(ECharts)
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapFunctionProcessor.java b/src/com/fr/solution/plugin/chart/echarts/monitor/MonitorMap.java
similarity index 57%
rename from src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapFunctionProcessor.java
rename to src/com/fr/solution/plugin/chart/echarts/monitor/MonitorMap.java
index f9fa675..0fe3dcb 100644
--- a/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapFunctionProcessor.java
+++ b/src/com/fr/solution/plugin/chart/echarts/monitor/MonitorMap.java
@@ -1,16 +1,19 @@
-package com.fr.solution.plugin.chart.echarts.core.map;
+package com.fr.solution.plugin.chart.echarts.monitor;
import com.fr.general.Inter;
import com.fr.stable.fun.FunctionHelper;
-import com.fr.stable.fun.FunctionProcessor;
import com.fr.stable.fun.impl.AbstractFunctionProcessor;
/**
- * Created by richie on 16/1/29.
+ * Created by richie on 16/2/18.
*/
-public class ChineseMapFunctionProcessor extends AbstractFunctionProcessor {
+public class MonitorMap extends AbstractFunctionProcessor {
- public static FunctionProcessor MAP = new ChineseMapFunctionProcessor();
+ private static MonitorMap instance = new MonitorMap();
+
+ public static MonitorMap getInstance() {
+ return instance;
+ }
@Override
public int getId() {
@@ -21,4 +24,4 @@ public class ChineseMapFunctionProcessor extends AbstractFunctionProcessor {
public String toString() {
return Inter.getLocText("Plugin-ECharts_Chinese_Map");
}
-}
\ No newline at end of file
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/monitor/MonitorPie.java b/src/com/fr/solution/plugin/chart/echarts/monitor/MonitorPie.java
new file mode 100644
index 0000000..6952376
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/monitor/MonitorPie.java
@@ -0,0 +1,27 @@
+package com.fr.solution.plugin.chart.echarts.monitor;
+
+import com.fr.general.Inter;
+import com.fr.stable.fun.FunctionHelper;
+import com.fr.stable.fun.impl.AbstractFunctionProcessor;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class MonitorPie extends AbstractFunctionProcessor {
+
+ private static MonitorPie instance = new MonitorPie();
+
+ public static MonitorPie getInstance() {
+ return instance;
+ }
+
+ @Override
+ public int getId() {
+ return FunctionHelper.generateFunctionID("com.fr.solution.plugin.chart.echarts");
+ }
+
+ @Override
+ public String toString() {
+ return Inter.getLocText("Plugin-ECharts_Pie");
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/plot/NewPlot.java b/src/com/fr/solution/plugin/chart/echarts/plot/EChartsPlot.java
similarity index 50%
rename from src/com/fr/solution/plugin/chart/echarts/plot/NewPlot.java
rename to src/com/fr/solution/plugin/chart/echarts/plot/EChartsPlot.java
index 71d32c8..5b8405e 100644
--- a/src/com/fr/solution/plugin/chart/echarts/plot/NewPlot.java
+++ b/src/com/fr/solution/plugin/chart/echarts/plot/EChartsPlot.java
@@ -4,26 +4,26 @@ import com.fr.chart.chartattr.Legend;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.general.ComparatorUtils;
-import com.fr.solution.plugin.chart.echarts.glyph.NewLegendGlyph;
-import com.fr.solution.plugin.chart.echarts.legend.NewLegend;
+import com.fr.solution.plugin.chart.echarts.glyph.EChartsLegendGlyph;
+import com.fr.solution.plugin.chart.echarts.legend.EChartsLegend;
import com.fr.stable.xml.XMLableReader;
/**
* Created by richie on 16/2/2.
*/
-public abstract class NewPlot extends Plot {
+public abstract class EChartsPlot extends Plot {
- public NewPlot() {
- setLegend(new NewLegend());
+ public EChartsPlot() {
+ setLegend(new EChartsLegend());
}
public boolean accept(Class extends Plot> obClass) {
- return ComparatorUtils.equals(NewPlot.class, obClass);
+ return ComparatorUtils.equals(EChartsPlot.class, obClass);
}
@Override
- public NewLegendGlyph createLegendGlyph(PlotGlyph plotGlyph) {
- NewLegend legend = (NewLegend) getLegend();
+ public EChartsLegendGlyph createLegendGlyph(PlotGlyph plotGlyph) {
+ EChartsLegend legend = (EChartsLegend) getLegend();
return legend.createLegendGlyph();
}
@@ -31,8 +31,8 @@ public abstract class NewPlot extends Plot {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
- if (NewLegend.XML_TAG.equals(tagName)) {
- setLegend((Legend)reader.readXMLObject(new NewLegend()));
+ if (EChartsLegend.XML_TAG.equals(tagName)) {
+ setLegend((Legend)reader.readXMLObject(new EChartsLegend()));
}
}
}
diff --git a/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlot.java b/src/com/fr/solution/plugin/chart/echarts/plot/map/ChineseMapPlot.java
similarity index 77%
rename from src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlot.java
rename to src/com/fr/solution/plugin/chart/echarts/plot/map/ChineseMapPlot.java
index 7628eea..ea4ec94 100644
--- a/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlot.java
+++ b/src/com/fr/solution/plugin/chart/echarts/plot/map/ChineseMapPlot.java
@@ -1,4 +1,4 @@
-package com.fr.solution.plugin.chart.echarts.core.map;
+package com.fr.solution.plugin.chart.echarts.plot.map;
import com.fr.base.chart.chartdata.ChartData;
import com.fr.chart.chartattr.Plot;
@@ -6,13 +6,15 @@ import com.fr.chart.chartdata.NormalChartData;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
-import com.fr.solution.plugin.chart.echarts.plot.NewPlot;
+import com.fr.solution.plugin.chart.echarts.glyph.map.ChineseMapPlotGlyph;
+import com.fr.solution.plugin.chart.echarts.monitor.MonitorMap;
+import com.fr.solution.plugin.chart.echarts.plot.EChartsPlot;
import com.fr.stable.fun.FunctionProcessor;
/**
* Created by richie on 16/1/29.
*/
-public class ChineseMapPlot extends NewPlot {
+public class ChineseMapPlot extends EChartsPlot {
@Override
public PlotGlyph createPlotGlyph(ChartData chartData) {
@@ -38,7 +40,7 @@ public class ChineseMapPlot extends NewPlot {
@Override
public FunctionProcessor getFunctionToRecord() {
- return ChineseMapFunctionProcessor.MAP;
+ return MonitorMap.getInstance();
}
public boolean accept(Class extends Plot> obClass) {
diff --git a/src/com/fr/solution/plugin/chart/echarts/plot/pie/EChartsPiePlot.java b/src/com/fr/solution/plugin/chart/echarts/plot/pie/EChartsPiePlot.java
new file mode 100644
index 0000000..f51282f
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/plot/pie/EChartsPiePlot.java
@@ -0,0 +1,99 @@
+package com.fr.solution.plugin.chart.echarts.plot.pie;
+
+import com.fr.base.chart.chartdata.ChartData;
+import com.fr.chart.chartattr.Plot;
+import com.fr.chart.chartdata.NormalChartData;
+import com.fr.chart.chartglyph.PlotGlyph;
+import com.fr.general.ComparatorUtils;
+import com.fr.general.Inter;
+import com.fr.solution.plugin.chart.echarts.glyph.pie.EChartsPiePlotGlyph;
+import com.fr.solution.plugin.chart.echarts.monitor.MonitorPie;
+import com.fr.solution.plugin.chart.echarts.plot.EChartsPlot;
+import com.fr.stable.StringUtils;
+import com.fr.stable.fun.FunctionProcessor;
+import com.fr.stable.xml.XMLPrintWriter;
+import com.fr.stable.xml.XMLableReader;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class EChartsPiePlot extends EChartsPlot {
+
+
+ private PieType pieType;
+
+ public EChartsPiePlot() {
+ this(PieType.REGULAR);
+ }
+
+ public EChartsPiePlot(PieType pieType) {
+ this.pieType = pieType;
+ }
+
+ public void setPieType(PieType pieType) {
+ this.pieType = pieType;
+ }
+
+ @Override
+ public PlotGlyph createPlotGlyph(ChartData chartData) {
+ PlotGlyph glyph = new EChartsPiePlotGlyph();
+ install4PlotGlyph(glyph, chartData);
+ return glyph;
+ }
+
+ @Override
+ public String getPlotID() {
+ return "EChartsPiePlot";
+ }
+
+ @Override
+ public boolean matchPlotType(Plot newPlot) {
+ return newPlot instanceof EChartsPiePlot;
+ }
+
+ @Override
+ public ChartData defaultChartData() {
+ return new NormalChartData();
+ }
+
+ @Override
+ public FunctionProcessor getFunctionToRecord() {
+ return MonitorPie.getInstance();
+ }
+
+ public boolean accept(Class extends Plot> obClass) {
+ return ComparatorUtils.equals(EChartsPiePlot.class, obClass);
+ }
+
+ @Override
+ public String getPlotName() {
+ return Inter.getLocText("Plugin-ECharts_Pie");
+ }
+
+ protected void readPlotXML(XMLableReader reader) {
+ super.readPlotXML(reader);
+ if (reader.isChildNode()) {
+ String tagName = reader.getTagName();
+
+ if (tagName.equals("PieAttr4ECharts")) {
+ pieType = PieType.parse(reader.getAttrAsString("pieType", StringUtils.EMPTY));
+ }
+ }
+ }
+
+
+ @Override
+ public void writeXML(XMLPrintWriter writer) {
+ super.writeXML(writer);
+ writer.startTAG("PieAttr4ECharts");
+ writer.attr("pieType", pieType.toTypeString());
+ writer.end();
+ }
+
+ @Override
+ public boolean equals(Object ob) {
+ return ob instanceof EChartsPiePlot
+ && super.equals(ob)
+ && ComparatorUtils.equals(((EChartsPiePlot) ob).pieType, pieType);
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/plot/pie/PieType.java b/src/com/fr/solution/plugin/chart/echarts/plot/pie/PieType.java
new file mode 100644
index 0000000..5edaef8
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/plot/pie/PieType.java
@@ -0,0 +1,40 @@
+package com.fr.solution.plugin.chart.echarts.plot.pie;
+
+import com.fr.general.ComparatorUtils;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public enum PieType {
+
+ REGULAR("regular"), CIRCLE("circle");
+
+ private String type;
+
+ PieType(String type) {
+ this.type = type;
+ }
+
+ public String toTypeString() {
+ return type;
+ }
+
+ private static PieType[] positions;
+
+ /**
+ * 将字符串转换成枚举类型
+ * @param p 待转换的整数
+ * @return 枚举
+ */
+ public static PieType parse(String p) {
+ if (positions == null) {
+ positions = PieType.values();
+ }
+ for (PieType ip : positions) {
+ if (ComparatorUtils.equals(p, ip.type)) {
+ return ip;
+ }
+ }
+ return REGULAR;
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/title/EChartsTitle.java b/src/com/fr/solution/plugin/chart/echarts/title/EChartsTitle.java
new file mode 100644
index 0000000..f0c1482
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/title/EChartsTitle.java
@@ -0,0 +1,16 @@
+package com.fr.solution.plugin.chart.echarts.title;
+
+import com.fr.chart.chartattr.Title;
+import com.fr.solution.plugin.chart.echarts.glyph.EChartsTitleGlyph;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class EChartsTitle extends Title {
+ public static final String XML_TAG = "EChartsTitle";
+
+ @Override
+ public EChartsTitleGlyph createGlyph() {
+ return new EChartsTitleGlyph();
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/title/NewTitle.java b/src/com/fr/solution/plugin/chart/echarts/title/NewTitle.java
deleted file mode 100644
index 7c39adc..0000000
--- a/src/com/fr/solution/plugin/chart/echarts/title/NewTitle.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.fr.solution.plugin.chart.echarts.title;
-
-import com.fr.chart.chartattr.Title;
-import com.fr.solution.plugin.chart.echarts.glyph.NewTitleGlyph;
-
-/**
- * Created by richie on 16/2/18.
- */
-public class NewTitle extends Title {
- public static final String XML_TAG = "NewTitle";
-
- @Override
- public NewTitleGlyph createGlyph() {
- return new NewTitleGlyph();
- }
-}
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/AbstractEChartsTypePane.java b/src/com/fr/solution/plugin/chart/echarts/ui/AbstractEChartsTypePane.java
new file mode 100644
index 0000000..a6869dd
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/AbstractEChartsTypePane.java
@@ -0,0 +1,73 @@
+package com.fr.solution.plugin.chart.echarts.ui;
+
+import com.fr.chart.chartattr.Chart;
+import com.fr.chart.chartattr.Plot;
+import com.fr.chart.chartglyph.ConditionCollection;
+import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
+import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
+import com.fr.solution.plugin.chart.echarts.base.ECharts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class AbstractEChartsTypePane extends AbstractChartTypePane{
+ private static final long serialVersionUID = 7743244512351499265L;
+
+ //新图表暂时还没有平面3d,渐变高光等布局。
+ @Override
+ protected List initStyleList() {
+ return new ArrayList();
+ }
+
+ @Override
+ protected String[] getTypeLayoutPath() {
+ return new String[]{
+ };
+ }
+
+ /**
+ * 保存界面属性
+ */
+ public void updateBean(Chart chart) {
+ checkTypeChange();
+ Plot oldPlot = chart.getPlot();
+ Plot newPlot = getSelectedClonedPlot();
+ boolean samePlot = accept(chart);
+ if(typeChanged && samePlot){
+ //同一中图表切换不同类型
+ cloneOldPlot2New(oldPlot, newPlot);
+ chart.setPlot(newPlot);
+ } else if(!samePlot){
+ //不同的图表类型切换
+ chart.setPlot(newPlot);
+ }
+ }
+
+ public boolean accept(Object ob) {
+ return ob instanceof ECharts;
+ }
+
+ protected void checkTypeChange(){
+ for(int i = 0; i < typeDemo.size(); i++){
+ if(typeDemo.get(i).isPressing && i != lastTypeIndex){
+ typeChanged = true;
+ lastTypeIndex = i;
+ break;
+ }
+ typeChanged = false;
+ }
+ }
+
+ /**
+ * 同一个图表, 类型之间切换
+ */
+ protected void cloneOldPlot2New(Plot oldPlot, Plot newPlot) {
+
+ }
+
+ protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{
+ if (oldPlot.getConditionCollection() != null) {
+ newPlot.setConditionCollection((ConditionCollection)oldPlot.getConditionCollection().clone());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/AbstractIndependentEChartsUI.java b/src/com/fr/solution/plugin/chart/echarts/ui/AbstractIndependentEChartsUI.java
new file mode 100644
index 0000000..caa0c71
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/AbstractIndependentEChartsUI.java
@@ -0,0 +1,14 @@
+package com.fr.solution.plugin.chart.echarts.ui;
+
+import com.fr.design.chart.fun.impl.AbstractIndependentChartUI;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public abstract class AbstractIndependentEChartsUI extends AbstractIndependentChartUI {
+
+ @Override
+ public boolean isUseDefaultPane() {
+ return false;
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/data/AbstractEChartsReportDataContentPane.java b/src/com/fr/solution/plugin/chart/echarts/ui/data/AbstractEChartsReportDataContentPane.java
new file mode 100644
index 0000000..acc59ae
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/data/AbstractEChartsReportDataContentPane.java
@@ -0,0 +1,10 @@
+package com.fr.solution.plugin.chart.echarts.ui.data;
+
+import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class AbstractEChartsReportDataContentPane extends CategoryPlotReportDataContentPane {
+
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/data/AbstractEChartsTableDataContentPane.java b/src/com/fr/solution/plugin/chart/echarts/ui/data/AbstractEChartsTableDataContentPane.java
new file mode 100644
index 0000000..6ee180c
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/data/AbstractEChartsTableDataContentPane.java
@@ -0,0 +1,164 @@
+package com.fr.solution.plugin.chart.echarts.ui.data;
+
+import com.fr.chart.base.ChartConstants;
+import com.fr.chart.chartattr.Bar2DPlot;
+import com.fr.chart.chartattr.ChartCollection;
+import com.fr.chart.chartdata.NormalTableDataDefinition;
+import com.fr.chart.chartdata.TopDefinition;
+import com.fr.design.gui.icombobox.UIComboBox;
+import com.fr.design.gui.ilable.BoldFontTextLabel;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.mainframe.chart.gui.ChartDataPane;
+import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.general.ComparatorUtils;
+import com.fr.general.Inter;
+import com.fr.solution.plugin.chart.echarts.ui.series.NewSeriesTypeUsePane;
+import com.fr.stable.ArrayUtils;
+import com.fr.stable.StringUtils;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+/**
+ * Created by richie on 16/1/29.
+ */
+public class AbstractEChartsTableDataContentPane extends AbstractTableDataContentPane {
+
+ protected UIComboBox categoryComboBox;
+ protected NewSeriesTypeUsePane seriesTypeUsePane;
+
+
+ public AbstractEChartsTableDataContentPane(ChartDataPane parent) {
+
+ categoryComboBox = new UIComboBox();
+ JPanel categoryPane = new JPanel(new BorderLayout(4, 0));
+ categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
+ UILabel label1 = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT);
+ label1.setPreferredSize(new Dimension(75, 20));
+ categoryComboBox.setPreferredSize(new Dimension(100, 20));
+
+ categoryComboBox.addItem(Inter.getLocText("Chart-Use_None"));
+ categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryComboBox, null, null, label1, null}));
+
+ this.setLayout(new BorderLayout());
+
+ this.add(categoryPane, BorderLayout.NORTH);
+
+ seriesTypeUsePane = new NewSeriesTypeUsePane(parent, new Bar2DPlot());
+ this.add(seriesTypeUsePane, BorderLayout.SOUTH);
+
+ categoryComboBox.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ checkSeriseUse(categoryComboBox.getSelectedItem() != null);
+ makeToolTipUse(categoryComboBox);
+ }
+ });
+ }
+
+ protected void makeToolTipUse(UIComboBox comBox) {
+ if (comBox.getSelectedItem() != null) {
+ comBox.setToolTipText(comBox.getSelectedItem().toString());
+ } else {
+ comBox.setToolTipText(null);
+ }
+ }
+
+ /**
+ * 检查 某些Box是否可用
+ *
+ * @param hasUse 是否使用.
+ */
+ public void checkBoxUse(boolean hasUse) {
+ categoryComboBox.setEnabled(hasUse);
+ checkSeriseUse(hasUse);
+ }
+
+ protected void checkSeriseUse(boolean hasUse) {
+ if (seriesTypeUsePane != null) {
+ seriesTypeUsePane.checkUseBox(hasUse && categoryComboBox.getSelectedItem() != null);
+ }
+ }
+
+ protected void refreshBoxListWithSelectTableData(java.util.List list) {
+ refreshBoxItems(categoryComboBox, list);
+ categoryComboBox.addItem(Inter.getLocText("Chart-Use_None"));
+
+ seriesTypeUsePane.refreshBoxListWithSelectTableData(list);
+ }
+
+ /**
+ * 清空所有的box设置
+ */
+ public void clearAllBoxList() {
+ clearBoxItems(categoryComboBox);
+ categoryComboBox.addItem(Inter.getLocText("Chart-Use_None"));
+ seriesTypeUsePane.clearAllBoxList();
+ }
+
+ /**
+ * 保存界面内容到ChartCollection
+ */
+ public void updateBean(ChartCollection collection) {
+ seriesTypeUsePane.updateBean(collection);
+ NormalTableDataDefinition dataDefinition = (NormalTableDataDefinition) collection.getSelectedChart().getFilterDefinition();
+ if (dataDefinition == null) {
+ return;
+ }
+ Object categoryName = categoryComboBox.getSelectedItem();
+
+ if (ArrayUtils.contains(ChartConstants.NONE_KEYS, categoryName)) {
+ dataDefinition.setCategoryName(StringUtils.EMPTY);
+ } else {
+ dataDefinition.setCategoryName(categoryName == null ? null : categoryName.toString());
+ }
+
+ }
+
+ /**
+ * 根据ChartCollection 更新界面
+ */
+ public void populateBean(ChartCollection collection) {
+ super.populateBean(collection);
+ TopDefinition top = (TopDefinition) collection.getSelectedChart().getFilterDefinition();
+
+ if (!(top instanceof NormalTableDataDefinition)) {
+ return;
+ }
+ NormalTableDataDefinition data = (NormalTableDataDefinition) top;
+
+ if (data == null || ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) {
+ categoryComboBox.setSelectedItem(Inter.getLocText("Chart-Use_None"));
+ } else if (data != null && !this.boxItemsContainsObject(categoryComboBox, data.getCategoryName())) {
+ categoryComboBox.setSelectedItem(null);
+ } else {
+ combineCustomEditValue(categoryComboBox, data == null ? null : data.getCategoryName());
+ }
+
+ seriesTypeUsePane.populateBean(collection, this.isNeedSummaryCaculateMethod());
+ }
+
+ private boolean boxItemsContainsObject(UIComboBox box, Object item) {
+ if (box == null) {
+ return false;
+ }
+
+ ComboBoxModel dataModel = box.getModel();
+ for (int i = 0; i < dataModel.getSize(); i++) {
+ if (ComparatorUtils.equals(dataModel.getElementAt(i), item)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 重新布局整个面板
+ */
+ public void redoLayoutPane() {
+ seriesTypeUsePane.relayoutPane(this.isNeedSummaryCaculateMethod());
+ }
+
+}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/filter/NewDataFilterPane.java b/src/com/fr/solution/plugin/chart/echarts/ui/filter/NewDataFilterPane.java
new file mode 100644
index 0000000..30bcbf8
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/filter/NewDataFilterPane.java
@@ -0,0 +1,36 @@
+package com.fr.solution.plugin.chart.echarts.ui.filter;
+
+import com.fr.chart.chartattr.ChartCollection;
+import com.fr.chart.chartattr.Plot;
+import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
+import com.fr.design.mainframe.chart.gui.ChartDataPane;
+import com.fr.design.mainframe.chart.gui.style.ThirdTabPane;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class NewDataFilterPane extends ThirdTabPane {
+
+ public NewDataFilterPane(Plot plot, ChartDataPane parent) {
+ super(plot, parent);
+ }
+
+ @Override
+ protected List initPaneList(Plot plot, AbstractAttrNoScrollPane parent) {
+ List paneList = new ArrayList();
+ return paneList;
+ }
+
+ @Override
+ public void populateBean(ChartCollection ob) {
+
+ }
+
+ @Override
+ protected String title4PopupWindow() {
+ return null;
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseChartTypePane.java b/src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseChartTypePane.java
index 1154080..12b8b8c 100644
--- a/src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseChartTypePane.java
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseChartTypePane.java
@@ -4,7 +4,7 @@ import com.fr.chart.chartattr.Chart;
import com.fr.design.mainframe.chart.gui.type.UserDefinedChartTypePane;
import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.ChineseMap;
-import com.fr.solution.plugin.chart.echarts.core.map.ChineseMapPlot;
+import com.fr.solution.plugin.chart.echarts.plot.map.ChineseMapPlot;
/**
* Created by richie on 16/1/29.
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseMapTableDataContentPane.java b/src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseMapTableDataContentPane.java
index e61f9c2..5517ebf 100644
--- a/src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseMapTableDataContentPane.java
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseMapTableDataContentPane.java
@@ -1,56 +1,14 @@
package com.fr.solution.plugin.chart.echarts.ui.map;
-import com.fr.chart.chartattr.ChartCollection;
-import com.fr.design.event.UIObserver;
-import com.fr.design.event.UIObserverListener;
-import com.fr.design.gui.frpane.UICorrelationPane;
-import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
-import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
-
-import javax.swing.*;
-import java.awt.*;
-import java.util.List;
+import com.fr.solution.plugin.chart.echarts.ui.data.AbstractEChartsTableDataContentPane;
/**
* Created by richie on 16/1/29.
*/
-public class ChineseMapTableDataContentPane extends AbstractTableDataContentPane implements UIObserver {
-
- private UICorrelationPane correlationPane;
+public class ChineseMapTableDataContentPane extends AbstractEChartsTableDataContentPane {
public ChineseMapTableDataContentPane(ChartDataPane parent) {
- setLayout(new BorderLayout());
- UILabel label = new UILabel("测试布局");
- setBorder(BorderFactory.createLineBorder(Color.RED));
- add(label, BorderLayout.NORTH);
- correlationPane = new UICorrelationPane("区域名", "区域值");
- add(correlationPane, BorderLayout.CENTER);
-
- }
-
- @Override
- public void updateBean(ChartCollection ob) {
-
- }
-
- @Override
- public void clearAllBoxList() {
-
- }
-
- @Override
- protected void refreshBoxListWithSelectTableData(List columnNameList) {
-
- }
-
- @Override
- public void registerChangeListener(UIObserverListener listener) {
-
- }
-
- @Override
- public boolean shouldResponseChangeListener() {
- return true;
+ super(parent);
}
}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieChartTypePane.java b/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieChartTypePane.java
new file mode 100644
index 0000000..851254c
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieChartTypePane.java
@@ -0,0 +1,67 @@
+package com.fr.solution.plugin.chart.echarts.ui.pie;
+
+import com.fr.chart.chartattr.Chart;
+import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
+import com.fr.design.mainframe.chart.gui.type.UserDefinedChartTypePane;
+import com.fr.general.Inter;
+import com.fr.solution.plugin.chart.echarts.EChartsPie;
+import com.fr.solution.plugin.chart.echarts.plot.pie.EChartsPiePlot;
+import com.fr.solution.plugin.chart.echarts.ui.AbstractEChartsTypePane;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by richie on 16/1/29.
+ */
+public class EChartsPieChartTypePane extends AbstractEChartsTypePane {
+ /**
+ * 弹出框的标题
+ *
+ * @return 弹出框的标题
+ */
+ public String title4PopupWindow() {
+ return Inter.getLocText("Plugin-ECharts_Pie");
+ }
+
+ public void updateBean(Chart chart) {
+ if (chart != null) {
+ chart.setPlot(new EChartsPiePlot());
+ }
+ }
+
+ /**
+ * 界面是否接受
+ *
+ * @param ob 对象是否为chart
+ * @return 界面是否接受对象
+ */
+ public boolean accept(Object ob) {
+ return (ob instanceof Chart) && ((Chart) ob).getPlot().accept(EChartsPiePlot.class);
+ }
+
+ @Override
+ public Chart getDefaultChart() {
+ return EChartsPie.charts[0];
+ }
+
+
+ @Override
+ protected List initDemoList() {
+ List demoList = new ArrayList();
+ String[] iconPaths = getTypeIconPath();
+ ChartImagePane pane = new ChartImagePane(iconPaths[0], "Regular");
+ pane.isPressing = true;
+ demoList.add(pane);
+ demoList.add(new ChartImagePane(iconPaths[1], "Circle"));
+ return demoList;
+ }
+
+ @Override
+ protected String[] getTypeIconPath() {
+ return new String[]{
+ "/com/fr/solution/plugin/chart/echarts/images/pie/pie_type1.png",
+ "/com/fr/solution/plugin/chart/echarts/images/pie/pie_type2.png"
+ };
+ }
+}
\ No newline at end of file
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieReportDataContentPane.java b/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieReportDataContentPane.java
new file mode 100644
index 0000000..6b33815
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieReportDataContentPane.java
@@ -0,0 +1,9 @@
+package com.fr.solution.plugin.chart.echarts.ui.pie;
+
+import com.fr.solution.plugin.chart.echarts.ui.data.AbstractEChartsReportDataContentPane;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class EChartsPieReportDataContentPane extends AbstractEChartsReportDataContentPane {
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieTableDataContentPane.java b/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieTableDataContentPane.java
new file mode 100644
index 0000000..5c8299c
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieTableDataContentPane.java
@@ -0,0 +1,14 @@
+package com.fr.solution.plugin.chart.echarts.ui.pie;
+
+import com.fr.design.mainframe.chart.gui.ChartDataPane;
+import com.fr.solution.plugin.chart.echarts.ui.data.AbstractEChartsTableDataContentPane;
+
+/**
+ * Created by richie on 16/2/18.
+ */
+public class EChartsPieTableDataContentPane extends AbstractEChartsTableDataContentPane {
+
+ public EChartsPieTableDataContentPane(ChartDataPane parent) {
+ super(parent);
+ }
+}
diff --git a/src/com/fr/solution/plugin/chart/echarts/ui/series/NewSeriesTypeUsePane.java b/src/com/fr/solution/plugin/chart/echarts/ui/series/NewSeriesTypeUsePane.java
new file mode 100644
index 0000000..441309f
--- /dev/null
+++ b/src/com/fr/solution/plugin/chart/echarts/ui/series/NewSeriesTypeUsePane.java
@@ -0,0 +1,159 @@
+package com.fr.solution.plugin.chart.echarts.ui.series;
+
+import com.fr.base.chart.chartdata.TopDefinitionProvider;
+import com.fr.chart.chartattr.ChartCollection;
+import com.fr.chart.chartattr.Plot;
+import com.fr.chart.chartdata.MoreNameCDDefinition;
+import com.fr.chart.chartdata.OneValueCDDefinition;
+import com.fr.design.beans.FurtherBasicBeanPane;
+import com.fr.design.constants.LayoutConstants;
+import com.fr.design.gui.frpane.UIComboBoxPane;
+import com.fr.design.gui.ilable.UILabel;
+import com.fr.design.mainframe.chart.gui.ChartDataPane;
+import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldNamePane;
+import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane;
+import com.fr.design.utils.gui.GUICoreUtils;
+import com.fr.general.Inter;
+import com.fr.solution.plugin.chart.echarts.ui.filter.NewDataFilterPane;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class NewSeriesTypeUsePane extends UIComboBoxPane {
+
+ private SeriesNameUseFieldValuePane nameFieldValuePane;
+ private SeriesNameUseFieldNamePane nameFieldNamePane;
+
+ private NewDataFilterPane dataFilterPane;
+
+ private ChartDataPane parent;
+ private Plot initplot;
+
+ private boolean isNeedSummary = true;
+
+ public NewSeriesTypeUsePane(ChartDataPane parent, Plot initPlot) {
+ cards = initPaneList();
+ this.parent = parent;
+ this.initplot = initPlot;
+ this.isNeedSummary = true;
+ initComponents();
+ }
+
+ protected void initLayout() {
+ this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
+ JPanel northPane = new JPanel(new BorderLayout(4, 0));
+ UILabel label1 = new UILabel(Inter.getLocText("ChartF-Series_Name_From") + ":", SwingConstants.RIGHT);
+ label1.setPreferredSize(new Dimension(75, 20));
+ northPane.add(GUICoreUtils.createBorderLayoutPane(
+ jcb, BorderLayout.CENTER,
+ label1, BorderLayout.WEST
+ ));
+ northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
+ add(northPane, BorderLayout.NORTH);
+ add(cardPane, BorderLayout.CENTER);
+
+ dataFilterPane = new NewDataFilterPane(initplot, parent);
+ add(dataFilterPane, BorderLayout.SOUTH);
+ }
+
+ /**
+ * 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用
+ *
+ * @param hasUse 是否使用
+ */
+ public void checkUseBox(boolean hasUse) {
+ jcb.setEnabled(hasUse);
+ nameFieldValuePane.checkUse(hasUse);
+ }
+
+ /**
+ * 切换 变更数据集时, 刷新Box选中项目
+ *
+ * @param list 列表
+ */
+ public void refreshBoxListWithSelectTableData(List list) {
+ nameFieldValuePane.refreshBoxListWithSelectTableData(list);
+ nameFieldNamePane.refreshBoxListWithSelectTableData(list);
+ }
+
+ /**
+ * 清空所有的box设置
+ */
+ public void clearAllBoxList() {
+ nameFieldValuePane.clearAllBoxList();
+ nameFieldNamePane.clearAllBoxList();
+ }
+
+ /**
+ * 界面标题
+ *
+ * @return 界面标题
+ */
+ protected String title4PopupWindow() {
+ return Inter.getLocText("ChartF-Series_Name_From");
+ }
+
+ @Override
+ protected List> initPaneList() {
+ nameFieldValuePane = new SeriesNameUseFieldValuePane();
+ nameFieldNamePane = new SeriesNameUseFieldNamePane();
+ List> paneList = new ArrayList>();
+ paneList.add(nameFieldValuePane);
+ paneList.add(nameFieldNamePane);
+ return paneList;
+ }
+
+ public void populateBean(ChartCollection ob, boolean isNeedSummary) {
+ this.isNeedSummary = isNeedSummary;
+ TopDefinitionProvider definition = ob.getSelectedChart().getFilterDefinition();
+ if (definition instanceof OneValueCDDefinition) {
+ this.setSelectedIndex(0);
+ nameFieldValuePane.populateBean(ob, isNeedSummary);
+ } else if (definition instanceof MoreNameCDDefinition) {
+ this.setSelectedIndex(1);
+ nameFieldNamePane.populateBean(ob, isNeedSummary);
+ }
+ }
+
+ /**
+ * 重新布局整个面板
+ *
+ * @param isNeedSummary 是否需要汇总
+ */
+ public void relayoutPane(boolean isNeedSummary) {
+ this.isNeedSummary = isNeedSummary;
+ if (jcb.getSelectedIndex() == 0) {
+ nameFieldValuePane.relayoutPane(this.isNeedSummary);
+ } else {
+ nameFieldNamePane.relayoutPane(this.isNeedSummary);
+ }
+ }
+
+
+ @Override
+ protected void comboBoxItemStateChanged() {
+ if (jcb.getSelectedIndex() == 0) {
+ nameFieldValuePane.relayoutPane(this.isNeedSummary);
+ } else {
+ nameFieldNamePane.relayoutPane(this.isNeedSummary);
+ }
+ }
+
+ public void populateBean(ChartCollection ob) {
+ this.populateBean(ob, true);
+ }
+
+ /**
+ * 保存界面属性到Ob-ChartCollection
+ */
+ public void updateBean(ChartCollection ob) {
+ if (this.getSelectedIndex() == 0) {
+ nameFieldValuePane.updateBean(ob);
+ } else {
+ nameFieldNamePane.updateBean(ob);
+ }
+ }
+
+}