diff --git a/src/com/fr/solution/plugin/chart/echarts/base/NewChart.java b/src/com/fr/solution/plugin/chart/echarts/base/NewChart.java index 1a83e86..fdc6b6e 100644 --- a/src/com/fr/solution/plugin/chart/echarts/base/NewChart.java +++ b/src/com/fr/solution/plugin/chart/echarts/base/NewChart.java @@ -3,7 +3,6 @@ package com.fr.solution.plugin.chart.echarts.base; import com.fr.base.chart.BaseChartGlyph; import com.fr.base.chart.chartdata.ChartData; import com.fr.chart.chartattr.Chart; -import com.fr.chart.chartattr.Plot; import com.fr.general.ComparatorUtils; /** @@ -11,20 +10,23 @@ import com.fr.general.ComparatorUtils; */ public class NewChart extends Chart { + private NewPlot newPlot; + + public NewChart() { setWrapperName("EChartsFactory"); } - public NewChart(Plot plot) { - setPlot(plot); + public NewChart(NewPlot plot) { setWrapperName("EChartsFactory"); + this.newPlot = plot; } @Override public BaseChartGlyph createGlyph(ChartData chartData) { - NewChartGlyph glyph = new NewChartGlyph(); + NewGlyph glyph = new NewGlyph(); glyph.setGeneralInfo(this); - glyph.setWrapperName(wrapperName); + glyph.setWrapperName(getWrapperName()); glyph.setChartImagePath(getImagePath()); glyph.setRequiredJS(getRequiredJS()); glyph.setJSDraw(isJSDraw()); diff --git a/src/com/fr/solution/plugin/chart/echarts/base/NewChartGlyph.java b/src/com/fr/solution/plugin/chart/echarts/base/NewGlyph.java similarity index 68% rename from src/com/fr/solution/plugin/chart/echarts/base/NewChartGlyph.java rename to src/com/fr/solution/plugin/chart/echarts/base/NewGlyph.java index f02cf19..a8f470d 100644 --- a/src/com/fr/solution/plugin/chart/echarts/base/NewChartGlyph.java +++ b/src/com/fr/solution/plugin/chart/echarts/base/NewGlyph.java @@ -9,14 +9,41 @@ import com.fr.stable.web.Repository; /** * Created by richie on 16/1/29. */ -public class NewChartGlyph extends ChartGlyph { +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; @@ -57,6 +84,7 @@ public class NewChartGlyph extends ChartGlyph { .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))) ); @@ -64,6 +92,7 @@ public class NewChartGlyph extends ChartGlyph { .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))) ); @@ -71,10 +100,17 @@ public class NewChartGlyph extends ChartGlyph { .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; + } } diff --git a/src/com/fr/solution/plugin/chart/echarts/base/NewLegendGlyph.java b/src/com/fr/solution/plugin/chart/echarts/base/NewLegendGlyph.java new file mode 100644 index 0000000..c4fe1d6 --- /dev/null +++ b/src/com/fr/solution/plugin/chart/echarts/base/NewLegendGlyph.java @@ -0,0 +1,9 @@ +package com.fr.solution.plugin.chart.echarts.base; + +import com.fr.chart.chartglyph.LegendGlyph; + +/** + * Created by richie on 16/2/2. + */ +public class NewLegendGlyph extends LegendGlyph { +} diff --git a/src/com/fr/solution/plugin/chart/echarts/base/NewPlot.java b/src/com/fr/solution/plugin/chart/echarts/base/NewPlot.java new file mode 100644 index 0000000..0cc6b13 --- /dev/null +++ b/src/com/fr/solution/plugin/chart/echarts/base/NewPlot.java @@ -0,0 +1,23 @@ +package com.fr.solution.plugin.chart.echarts.base; + +import com.fr.base.chart.chartdata.ChartData; +import com.fr.chart.chartattr.Plot; +import com.fr.general.ComparatorUtils; + +/** + * Created by richie on 16/2/2. + */ +public abstract class NewPlot extends Plot { + + public boolean accept(Class obClass) { + return ComparatorUtils.equals(NewPlot.class, obClass); + } + + public NewTitleGlyph createChartTitleGlyph(ChartData chartData) { + return null; + } + + public NewLegendGlyph createChartLegendGlyph(ChartData chartData) { + return new NewLegendGlyph(); + } +} diff --git a/src/com/fr/solution/plugin/chart/echarts/base/NewSeriesGlyph.java b/src/com/fr/solution/plugin/chart/echarts/base/NewSeriesGlyph.java new file mode 100644 index 0000000..33d7666 --- /dev/null +++ b/src/com/fr/solution/plugin/chart/echarts/base/NewSeriesGlyph.java @@ -0,0 +1,10 @@ +package com.fr.solution.plugin.chart.echarts.base; + +import com.fr.chart.chartglyph.ChartGlyph; + +/** + * Created by richie on 16/2/2. + */ +public class NewSeriesGlyph extends ChartGlyph { + +} diff --git a/src/com/fr/solution/plugin/chart/echarts/base/NewTitleGlyph.java b/src/com/fr/solution/plugin/chart/echarts/base/NewTitleGlyph.java new file mode 100644 index 0000000..a121123 --- /dev/null +++ b/src/com/fr/solution/plugin/chart/echarts/base/NewTitleGlyph.java @@ -0,0 +1,23 @@ +package com.fr.solution.plugin.chart.echarts.base; + +import com.fr.chart.chartglyph.ChartGlyph; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.stable.web.Repository; + +/** + * Created by richie on 16/2/2. + */ +public class NewTitleGlyph extends ChartGlyph { + + + public NewTitleGlyph(String title, String subTitle) { + + } + + @Override + public JSONObject toJSONObject(Repository repo) throws JSONException { + return super.toJSONObject(repo); + } + +} diff --git a/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlot.java b/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlot.java index 90e4a48..a89f281 100644 --- a/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlot.java +++ b/src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlot.java @@ -3,15 +3,17 @@ package com.fr.solution.plugin.chart.echarts.core.map; import com.fr.base.chart.chartdata.ChartData; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartdata.NormalChartData; +import com.fr.chart.chartglyph.LegendGlyph; import com.fr.chart.chartglyph.PlotGlyph; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; +import com.fr.solution.plugin.chart.echarts.base.NewPlot; import com.fr.stable.fun.FunctionProcessor; /** * Created by richie on 16/1/29. */ -public class ChineseMapPlot extends Plot { +public class ChineseMapPlot extends NewPlot { @Override public PlotGlyph createPlotGlyph(ChartData chartData) { @@ -48,4 +50,5 @@ public class ChineseMapPlot extends Plot { public String getPlotName() { return Inter.getLocText("Plugin-ECharts_Chinese_Map"); } + } diff --git a/src/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js b/src/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js index c9027b8..5d01027 100644 --- a/src/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js +++ b/src/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js @@ -25,9 +25,9 @@ EChartsFactory.prototype = { }, resize : function() { - + this.newCharts.resize(); }, - refresh:function(){ + refresh:function() { },