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. 4
      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.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());

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.
*/
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;
}
}

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.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");
}
}

4
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() {
},

Loading…
Cancel
Save