Browse Source

echarts地图问题

pull/1/head
richie 9 years ago
parent
commit
b5b6228095
  1. 12
      src/com/fr/solution/plugin/chart/echarts/base/NewChart.java
  2. 38
      src/com/fr/solution/plugin/chart/echarts/base/NewGlyph.java
  3. 9
      src/com/fr/solution/plugin/chart/echarts/base/NewLegendGlyph.java
  4. 23
      src/com/fr/solution/plugin/chart/echarts/base/NewPlot.java
  5. 10
      src/com/fr/solution/plugin/chart/echarts/base/NewSeriesGlyph.java
  6. 23
      src/com/fr/solution/plugin/chart/echarts/base/NewTitleGlyph.java
  7. 5
      src/com/fr/solution/plugin/chart/echarts/core/map/ChineseMapPlot.java
  8. 2
      src/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js

12
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.BaseChartGlyph;
import com.fr.base.chart.chartdata.ChartData; import com.fr.base.chart.chartdata.ChartData;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
/** /**
@ -11,20 +10,23 @@ import com.fr.general.ComparatorUtils;
*/ */
public class NewChart extends Chart { public class NewChart extends Chart {
private NewPlot newPlot;
public NewChart() { public NewChart() {
setWrapperName("EChartsFactory"); setWrapperName("EChartsFactory");
} }
public NewChart(Plot plot) { public NewChart(NewPlot plot) {
setPlot(plot);
setWrapperName("EChartsFactory"); setWrapperName("EChartsFactory");
this.newPlot = plot;
} }
@Override @Override
public BaseChartGlyph createGlyph(ChartData chartData) { public BaseChartGlyph createGlyph(ChartData chartData) {
NewChartGlyph glyph = new NewChartGlyph(); NewGlyph glyph = new NewGlyph();
glyph.setGeneralInfo(this); glyph.setGeneralInfo(this);
glyph.setWrapperName(wrapperName); glyph.setWrapperName(getWrapperName());
glyph.setChartImagePath(getImagePath()); glyph.setChartImagePath(getImagePath());
glyph.setRequiredJS(getRequiredJS()); glyph.setRequiredJS(getRequiredJS());
glyph.setJSDraw(isJSDraw()); glyph.setJSDraw(isJSDraw());

38
src/com/fr/solution/plugin/chart/echarts/base/NewChartGlyph.java → 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. * 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 @Override
public JSONObject toJSONObject(Repository repo) throws JSONException { public JSONObject toJSONObject(Repository repo) throws JSONException {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("title", createTitle(repo)); jo.put("title", createTitle(repo));
// if (titleGlyph != null) {
// jo.put("title", titleGlyph.toJSONObject(repo));
// }
jo.put("tooltip", createTooltip(repo)); jo.put("tooltip", createTooltip(repo));
jo.put("legend", createLegend(repo)); jo.put("legend", createLegend(repo));
// if (legendGlyph != null) {
// jo.put("legend", legendGlyph.toJSONObject(repo));
// }
jo.put("dataRange", createDataRange(repo)); jo.put("dataRange", createDataRange(repo));
jo.put("series", createSeries(repo)); jo.put("series", createSeries(repo));
return jo; return jo;
@ -57,6 +84,7 @@ public class NewChartGlyph extends ChartGlyph {
.put("name", "iPhone3") .put("name", "iPhone3")
.put("type", "map") .put("type", "map")
.put("mapType", "china") .put("mapType", "china")
.put("itemStyle", createItemStyle(repo))
.put("data", JSONArray.create().put(JSONObject.create().put("name", "ąąžŠ").put("value", 20))) .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("name", "iPhone4")
.put("type", "map") .put("type", "map")
.put("mapType", "china") .put("mapType", "china")
.put("itemStyle", createItemStyle(repo))
.put("data", JSONArray.create().put(JSONObject.create().put("name", ­ËŐ").put("value", 20))) .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("name", "iPhone5")
.put("type", "map") .put("type", "map")
.put("mapType", "china") .put("mapType", "china")
.put("itemStyle", createItemStyle(repo))
.put("data", JSONArray.create().put(JSONObject.create().put("name", "ËÄ´¨").put("value", 20))) .put("data", JSONArray.create().put(JSONObject.create().put("name", "ËÄ´¨").put("value", 20)))
); );
return series; 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;
}
} }

9
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 {
}

23
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<? extends Plot> obClass) {
return ComparatorUtils.equals(NewPlot.class, obClass);
}
public NewTitleGlyph createChartTitleGlyph(ChartData chartData) {
return null;
}
public NewLegendGlyph createChartLegendGlyph(ChartData chartData) {
return new NewLegendGlyph();
}
}

10
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 {
}

23
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);
}
}

5
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.base.chart.chartdata.ChartData;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.NormalChartData; import com.fr.chart.chartdata.NormalChartData;
import com.fr.chart.chartglyph.LegendGlyph;
import com.fr.chart.chartglyph.PlotGlyph; import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.base.NewPlot;
import com.fr.stable.fun.FunctionProcessor; import com.fr.stable.fun.FunctionProcessor;
/** /**
* Created by richie on 16/1/29. * Created by richie on 16/1/29.
*/ */
public class ChineseMapPlot extends Plot { public class ChineseMapPlot extends NewPlot {
@Override @Override
public PlotGlyph createPlotGlyph(ChartData chartData) { public PlotGlyph createPlotGlyph(ChartData chartData) {
@ -48,4 +50,5 @@ public class ChineseMapPlot extends Plot {
public String getPlotName() { public String getPlotName() {
return Inter.getLocText("Plugin-ECharts_Chinese_Map"); return Inter.getLocText("Plugin-ECharts_Chinese_Map");
} }
} }

2
src/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js

@ -25,7 +25,7 @@ EChartsFactory.prototype = {
}, },
resize : function() { resize : function() {
this.newCharts.resize();
}, },
refresh:function() { refresh:function() {

Loading…
Cancel
Save