Browse Source

echarts基本功能

pull/1/head
richie 9 years ago
parent
commit
e5978fae6c
  1. 13
      plugin.xml
  2. 4
      src/com/fr/solution/plugin/chart/echarts/common/EChartsFileLoader.java
  3. 2
      src/com/fr/solution/plugin/chart/echarts/common/EChartsLocaleFinder.java
  4. 4
      src/com/fr/solution/plugin/chart/echarts/common/base/AbstractIndependentEChartsProvider.java
  5. 51
      src/com/fr/solution/plugin/chart/echarts/common/base/ECharts.java
  6. 19
      src/com/fr/solution/plugin/chart/echarts/common/data/EChartsMoreNameCDDefinition.java
  7. 27
      src/com/fr/solution/plugin/chart/echarts/common/data/EChartsNormalChartData.java
  8. 17
      src/com/fr/solution/plugin/chart/echarts/common/data/EChartsNormalReportDataDefinition.java
  9. 19
      src/com/fr/solution/plugin/chart/echarts/common/data/EChartsOneValueCDDefinition.java
  10. 4
      src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsGlyph.java
  11. 38
      src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsLegendGlyph.java
  12. 2
      src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsPlotGlyph.java
  13. 13
      src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsTitleGlyph.java
  14. 10
      src/com/fr/solution/plugin/chart/echarts/common/legend/EChartsLegend.java
  15. 8
      src/com/fr/solution/plugin/chart/echarts/common/plot/EChartsPlot.java
  16. 52
      src/com/fr/solution/plugin/chart/echarts/common/title/EChartsTitle.java
  17. 4
      src/com/fr/solution/plugin/chart/echarts/common/ui/AbstractEChartsTypePane.java
  18. 25
      src/com/fr/solution/plugin/chart/echarts/common/ui/AbstractIndependentEChartsUI.java
  19. 218
      src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsStylePane.java
  20. 90
      src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsTitlePane.java
  21. 31
      src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsTooltipPane.java
  22. 2
      src/com/fr/solution/plugin/chart/echarts/common/ui/data/AbstractEChartsReportDataContentPane.java
  23. 4
      src/com/fr/solution/plugin/chart/echarts/common/ui/data/AbstractEChartsTableDataContentPane.java
  24. 2
      src/com/fr/solution/plugin/chart/echarts/common/ui/filter/NewDataFilterPane.java
  25. 4
      src/com/fr/solution/plugin/chart/echarts/common/ui/series/NewSeriesTypeUsePane.java
  26. 374
      src/com/fr/solution/plugin/chart/echarts/common/web/echarts.bridge.js
  27. 0
      src/com/fr/solution/plugin/chart/echarts/common/web/lib/echarts-all.js
  28. 0
      src/com/fr/solution/plugin/chart/echarts/common/web/lib/echarts.min.js
  29. 25
      src/com/fr/solution/plugin/chart/echarts/glyph/EChartsLegendGlyph.java
  30. 26
      src/com/fr/solution/plugin/chart/echarts/glyph/pie/EChartsPiePlotGlyph.java
  31. BIN
      src/com/fr/solution/plugin/chart/echarts/images/toolbar_item.png
  32. 10
      src/com/fr/solution/plugin/chart/echarts/map/ChineseMap.java
  33. 13
      src/com/fr/solution/plugin/chart/echarts/map/ChineseMapUI.java
  34. 4
      src/com/fr/solution/plugin/chart/echarts/map/glyph/ChineseMapPlotGlyph.java
  35. 0
      src/com/fr/solution/plugin/chart/echarts/map/images/chinese.png
  36. 0
      src/com/fr/solution/plugin/chart/echarts/map/images/map256.png
  37. 0
      src/com/fr/solution/plugin/chart/echarts/map/images/map_type1.png
  38. 2
      src/com/fr/solution/plugin/chart/echarts/map/monitor/MonitorMap.java
  39. 8
      src/com/fr/solution/plugin/chart/echarts/map/plot/ChineseMapPlot.java
  40. 8
      src/com/fr/solution/plugin/chart/echarts/map/ui/ChineseChartTypePane.java
  41. 2
      src/com/fr/solution/plugin/chart/echarts/map/ui/ChineseMapReportDataContentPane.java
  42. 4
      src/com/fr/solution/plugin/chart/echarts/map/ui/ChineseMapTableDataContentPane.java
  43. 12
      src/com/fr/solution/plugin/chart/echarts/pie/EChartsPie.java
  44. 12
      src/com/fr/solution/plugin/chart/echarts/pie/EChartsPieUI.java
  45. 51
      src/com/fr/solution/plugin/chart/echarts/pie/glyph/EChartsPiePlotGlyph.java
  46. 0
      src/com/fr/solution/plugin/chart/echarts/pie/images/pie.png
  47. 0
      src/com/fr/solution/plugin/chart/echarts/pie/images/pie256.png
  48. 0
      src/com/fr/solution/plugin/chart/echarts/pie/images/pie_type1.png
  49. 0
      src/com/fr/solution/plugin/chart/echarts/pie/images/pie_type2.png
  50. 2
      src/com/fr/solution/plugin/chart/echarts/pie/monitor/MonitorPie.java
  51. 8
      src/com/fr/solution/plugin/chart/echarts/pie/plot/EChartsPiePlot.java
  52. 2
      src/com/fr/solution/plugin/chart/echarts/pie/plot/PieType.java
  53. 13
      src/com/fr/solution/plugin/chart/echarts/pie/ui/EChartsPieChartTypePane.java
  54. 9
      src/com/fr/solution/plugin/chart/echarts/pie/ui/EChartsPieReportDataContentPane.java
  55. 14
      src/com/fr/solution/plugin/chart/echarts/pie/ui/EChartsPieTableDataContentPane.java
  56. 16
      src/com/fr/solution/plugin/chart/echarts/title/EChartsTitle.java
  57. 14
      src/com/fr/solution/plugin/chart/echarts/ui/AbstractIndependentEChartsUI.java
  58. 9
      src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieReportDataContentPane.java
  59. 14
      src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieTableDataContentPane.java
  60. 42
      src/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js

13
plugin.xml

@ -11,26 +11,25 @@
<change-notes><![CDATA[
<p>[2016-01-01]中国地图</p>
<p>[2016-02-18]饼图</p>
]]></change-notes>
<extra-core>
<LocaleFinder class="com.fr.solution.plugin.chart.echarts.EChartsLocaleFinder"/>
<JavaScriptFileHandler class="com.fr.solution.plugin.chart.echarts.EChartsFileLoader"/>
<LocaleFinder class="com.fr.solution.plugin.chart.echarts.common.EChartsLocaleFinder"/>
<JavaScriptFileHandler class="com.fr.solution.plugin.chart.echarts.common.EChartsFileLoader"/>
</extra-core>
<extra-report/>
<extra-designer/>
<extra-platform/>
<extra-chart>
<IndependentChartProvider class="com.fr.solution.plugin.chart.echarts.EChartsPie"
<IndependentChartProvider class="com.fr.solution.plugin.chart.echarts.pie.EChartsPie"
plotID="EChartsPiePlot"/>
<IndependentChartProvider class="com.fr.solution.plugin.chart.echarts.ChineseMap"
<IndependentChartProvider class="com.fr.solution.plugin.chart.echarts.map.ChineseMap"
plotID="EChartsChinaMapPlot"/>
</extra-chart>
<extra-chart-designer>
<IndependentChartUIProvider class="com.fr.solution.plugin.chart.echarts.EChartsPieUI"
<IndependentChartUIProvider class="com.fr.solution.plugin.chart.echarts.pie.EChartsPieUI"
plotID="EChartsPiePlot"/>
<IndependentChartUIProvider class="com.fr.solution.plugin.chart.echarts.ChineseMapUI"
<IndependentChartUIProvider class="com.fr.solution.plugin.chart.echarts.map.ChineseMapUI"
plotID="EChartsChinaMapPlot"/>
</extra-chart-designer>
</plugin>

4
src/com/fr/solution/plugin/chart/echarts/EChartsFileLoader.java → src/com/fr/solution/plugin/chart/echarts/common/EChartsFileLoader.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts;
package com.fr.solution.plugin.chart.echarts.common;
import com.fr.stable.EncodeConstants;
import com.fr.stable.fun.impl.AbstractJavaScriptFileHandler;
@ -10,7 +10,7 @@ public class EChartsFileLoader extends AbstractJavaScriptFileHandler {
@Override
public String[] pathsForFiles() {
return new String[]{
"/com/fr/solution/plugin/chart/echarts/web/lib/echarts-all.js"
"/com/fr/solution/plugin/chart/echarts/common/web/lib/echarts-all.js"
};
}

2
src/com/fr/solution/plugin/chart/echarts/EChartsLocaleFinder.java → src/com/fr/solution/plugin/chart/echarts/common/EChartsLocaleFinder.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts;
package com.fr.solution.plugin.chart.echarts.common;
import com.fr.stable.fun.impl.AbstractLocaleFinder;

4
src/com/fr/solution/plugin/chart/echarts/base/AbstractIndependentEChartsProvider.java → src/com/fr/solution/plugin/chart/echarts/common/base/AbstractIndependentEChartsProvider.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.base;
package com.fr.solution.plugin.chart.echarts.common.base;
import com.fr.chart.fun.impl.AbstractIndependentChartProvider;
@ -10,7 +10,7 @@ public abstract class AbstractIndependentEChartsProvider extends AbstractIndepen
@Override
public String[] getRequiredJS() {
return new String[]{
"/com/fr/solution/plugin/chart/echarts/web/echarts.bridge.js"
"/com/fr/solution/plugin/chart/echarts/common/web/echarts.bridge.js"
};
}

51
src/com/fr/solution/plugin/chart/echarts/base/ECharts.java → src/com/fr/solution/plugin/chart/echarts/common/base/ECharts.java

@ -1,17 +1,24 @@
package com.fr.solution.plugin.chart.echarts.base;
package com.fr.solution.plugin.chart.echarts.common.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.ChartXMLCompatibleUtils;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.TopDefinition;
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.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.solution.plugin.chart.echarts.common.data.EChartsMoreNameCDDefinition;
import com.fr.solution.plugin.chart.echarts.common.data.EChartsNormalReportDataDefinition;
import com.fr.solution.plugin.chart.echarts.common.data.EChartsOneValueCDDefinition;
import com.fr.solution.plugin.chart.echarts.common.glyph.EChartsGlyph;
import com.fr.solution.plugin.chart.echarts.common.glyph.EChartsLegendGlyph;
import com.fr.solution.plugin.chart.echarts.common.glyph.EChartsTitleGlyph;
import com.fr.solution.plugin.chart.echarts.common.plot.EChartsPlot;
import com.fr.solution.plugin.chart.echarts.common.title.EChartsTitle;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader;
/**
@ -76,8 +83,40 @@ public class ECharts extends Chart {
reader.readXMLObject(getTitle());
} else if (tmpNodeName.equals(Plot.XML_TAG)) {
setPlot((Plot) GeneralXMLTools.readXMLable(reader));
} else if (tmpNodeName.equals("ChartAttr")) {
this.setJSDraw(reader.getAttrAsBoolean("isJSDraw", true));
this.setStyleGlobal(reader.getAttrAsBoolean("isStyleGlobal",false));
} else if(ComparatorUtils.equals(tmpNodeName, "ChartDefinition")) {
reader.readXMLObject(new XMLReadable() {
public void readXML(XMLableReader reader) {
setFilterDefinition(readDefinition(reader));
}
});
}
}
}
public static TopDefinition readDefinition(XMLableReader reader) {
TopDefinition filterDefinition;
String tmpNodeName = reader.getTagName();
if (EChartsOneValueCDDefinition.XML_TAG.equals(tmpNodeName)) {
filterDefinition = new EChartsOneValueCDDefinition();
} else if (EChartsMoreNameCDDefinition.XML_TAG.equals(tmpNodeName)) {
filterDefinition = new EChartsMoreNameCDDefinition();
} else if (EChartsNormalReportDataDefinition.XML_TAG.equals(tmpNodeName)) {
filterDefinition = new EChartsNormalReportDataDefinition();
}else {
return ChartXMLCompatibleUtils.readDefinition(reader);
}
reader.readXMLObject(filterDefinition);
return filterDefinition;
}
@Override
public void writeXML(XMLPrintWriter writer) {
super.writeXML(writer);
}
}

19
src/com/fr/solution/plugin/chart/echarts/common/data/EChartsMoreNameCDDefinition.java

@ -0,0 +1,19 @@
package com.fr.solution.plugin.chart.echarts.common.data;
import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.NormalChartData;
/**
* Created by Mitisky on 16/1/19.
*/
public class EChartsMoreNameCDDefinition extends MoreNameCDDefinition {
private static final long serialVersionUID = -2555257182076448042L;
protected NormalChartData getNormalChartData(Object[] series_name_array, Object[][] series_v_2D) {
NormalChartData normal = new EChartsNormalChartData(categoryLabels, series_name_array, series_v_2D);
normal.setSecondCates(secondLabels);
normal.setThirdCates(thirdLabels);
return normal;
}
}

27
src/com/fr/solution/plugin/chart/echarts/common/data/EChartsNormalChartData.java

@ -0,0 +1,27 @@
package com.fr.solution.plugin.chart.echarts.common.data;
import com.fr.chart.chartdata.NormalChartData;
/**
* Created by Mitisky on 16/1/19.
* 不做大数据过滤
*/
public class EChartsNormalChartData extends NormalChartData {
public EChartsNormalChartData() {
}
public EChartsNormalChartData(Object[] category_array, Object[] series_array, Object[][] series_value_2D) {
super(category_array, series_array, series_value_2D);
}
/**
* 处理大数据.1000分类.
* 不做任何处理
*/
public void dealHugeData() {
//新的图表数据不在这里处理大数据
//画图的时候处理:折线图相同像素点只画一个,其他图表有配置是否采用大数据模式。
}
}

17
src/com/fr/solution/plugin/chart/echarts/common/data/EChartsNormalReportDataDefinition.java

@ -0,0 +1,17 @@
package com.fr.solution.plugin.chart.echarts.common.data;
import com.fr.chart.chartdata.NormalChartData;
import com.fr.chart.chartdata.NormalReportDataDefinition;
/**
* Created by Mitisky on 16/1/19.
*
*/
public class EChartsNormalReportDataDefinition extends NormalReportDataDefinition {
private static final long serialVersionUID = -645098535257304519L;
protected NormalChartData getNormalDataObject() {
return new EChartsNormalChartData();
}
}

19
src/com/fr/solution/plugin/chart/echarts/common/data/EChartsOneValueCDDefinition.java

@ -0,0 +1,19 @@
package com.fr.solution.plugin.chart.echarts.common.data;
import com.fr.chart.chartdata.NormalChartData;
import com.fr.chart.chartdata.OneValueCDDefinition;
/**
* Created by Mitisky on 16/1/19.
*/
public class EChartsOneValueCDDefinition extends OneValueCDDefinition {
private static final long serialVersionUID = -7069079313068958054L;
protected NormalChartData getNormalChartData(Object[] series_name_array, Object[][] series_v_2D) {
NormalChartData normal = new EChartsNormalChartData(categoryLabels, series_name_array, series_v_2D);
normal.setSecondCates(secondLabels);
normal.setThirdCates(thirdLabels);
return normal;
}
}

4
src/com/fr/solution/plugin/chart/echarts/glyph/EChartsGlyph.java → src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsGlyph.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.glyph;
package com.fr.solution.plugin.chart.echarts.common.glyph;
import com.fr.chart.chartglyph.ChartGlyph;
import com.fr.json.JSONArray;
@ -24,7 +24,7 @@ public class EChartsGlyph extends ChartGlyph {
if (legendGlyph != null) {
jo.put("legend", legendGlyph.toJSONObject(repo));
}
jo.put("dataRange", createDataRange(repo));
//jo.put("dataRange", createDataRange(repo));
EChartsPlotGlyph plotGlyph = (EChartsPlotGlyph) getPlotGlyph();
if (plotGlyph != null) {
jo.put("series", plotGlyph.toSeriesData(repo));

38
src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsLegendGlyph.java

@ -0,0 +1,38 @@
package com.fr.solution.plugin.chart.echarts.common.glyph;
import com.fr.chart.chartglyph.LegendGlyph;
import com.fr.chart.chartglyph.LegendItem;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.stable.ArrayUtils;
import com.fr.stable.web.Repository;
/**
* Created by richie on 16/2/2.
*/
public class EChartsLegendGlyph extends LegendGlyph {
public EChartsLegendGlyph(LegendItem[] items) {
super(items);
}
@Override
public JSONObject toJSONObject(Repository repo) throws JSONException {
JSONObject result = JSONObject.create()
.put("orient", "horizontal")
.put("y", "bottom");
LegendItem[] items = getItems();
if (ArrayUtils.isNotEmpty(items)) {
JSONArray data = JSONArray.create();
result.put("data", data);
for (LegendItem item : items) {
JSONObject jo = item.toJSONObject(repo);
data.put(jo.optString("label"));
}
}
return result;
}
}

2
src/com/fr/solution/plugin/chart/echarts/glyph/EChartsPlotGlyph.java → src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsPlotGlyph.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.glyph;
package com.fr.solution.plugin.chart.echarts.common.glyph;
import com.fr.chart.chartglyph.PlotGlyph;
import com.fr.json.JSONArray;

13
src/com/fr/solution/plugin/chart/echarts/glyph/EChartsTitleGlyph.java → src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsTitleGlyph.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.glyph;
package com.fr.solution.plugin.chart.echarts.common.glyph;
import com.fr.chart.chartglyph.TitleGlyph;
import com.fr.json.JSONException;
@ -10,12 +10,9 @@ import com.fr.stable.web.Repository;
*/
public class EChartsTitleGlyph extends TitleGlyph {
public EChartsTitleGlyph() {
}
public EChartsTitleGlyph(String title, String subTitle) {
public EChartsTitleGlyph(String title) {
setText(title);
}
@Override
@ -25,9 +22,7 @@ public class EChartsTitleGlyph extends TitleGlyph {
private JSONObject createTitle(Repository repo) throws JSONException {
return JSONObject.create()
.put("text", "iPhone销量")
.put("subtext", "纯属虚构")
.put("text", getText())
.put("x", "center");
}
}

10
src/com/fr/solution/plugin/chart/echarts/legend/EChartsLegend.java → src/com/fr/solution/plugin/chart/echarts/common/legend/EChartsLegend.java

@ -1,7 +1,8 @@
package com.fr.solution.plugin.chart.echarts.legend;
package com.fr.solution.plugin.chart.echarts.common.legend;
import com.fr.chart.chartattr.Legend;
import com.fr.solution.plugin.chart.echarts.glyph.EChartsLegendGlyph;
import com.fr.chart.chartglyph.LegendItem;
import com.fr.solution.plugin.chart.echarts.common.glyph.EChartsLegendGlyph;
/**
* Created by richie on 16/2/18.
@ -10,8 +11,8 @@ public class EChartsLegend extends Legend {
public static final String XML_TAG = "EChartsLegend";
public EChartsLegendGlyph createLegendGlyph() {
EChartsLegendGlyph resultLegendGlyph = new EChartsLegendGlyph();
public EChartsLegendGlyph createLegendGlyph(LegendItem[] items) {
EChartsLegendGlyph resultLegendGlyph = new EChartsLegendGlyph(items);
resultLegendGlyph.setFont(getFRFont());
resultLegendGlyph.setGeneralInfo(this);
@ -20,5 +21,4 @@ public class EChartsLegend extends Legend {
return resultLegendGlyph;
}
}

8
src/com/fr/solution/plugin/chart/echarts/plot/EChartsPlot.java → src/com/fr/solution/plugin/chart/echarts/common/plot/EChartsPlot.java

@ -1,11 +1,11 @@
package com.fr.solution.plugin.chart.echarts.plot;
package com.fr.solution.plugin.chart.echarts.common.plot;
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.EChartsLegendGlyph;
import com.fr.solution.plugin.chart.echarts.legend.EChartsLegend;
import com.fr.solution.plugin.chart.echarts.common.glyph.EChartsLegendGlyph;
import com.fr.solution.plugin.chart.echarts.common.legend.EChartsLegend;
import com.fr.stable.xml.XMLableReader;
/**
@ -24,7 +24,7 @@ public abstract class EChartsPlot extends Plot {
@Override
public EChartsLegendGlyph createLegendGlyph(PlotGlyph plotGlyph) {
EChartsLegend legend = (EChartsLegend) getLegend();
return legend.createLegendGlyph();
return legend.createLegendGlyph(createLegendItems(plotGlyph));
}
protected void readPlotXML(XMLableReader reader){

52
src/com/fr/solution/plugin/chart/echarts/common/title/EChartsTitle.java

@ -0,0 +1,52 @@
package com.fr.solution.plugin.chart.echarts.common.title;
import com.fr.base.Formula;
import com.fr.base.Utils;
import com.fr.chart.chartattr.Title;
import com.fr.general.GeneralUtils;
import com.fr.solution.plugin.chart.echarts.common.glyph.EChartsTitleGlyph;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
/**
* Created by richie on 16/2/18.
*/
public class EChartsTitle extends Title {
public static final String XML_TAG = "EChartsTitle";
@Override
public EChartsTitleGlyph createGlyph() {
Object text = getTextObject();
String text4Glyph = null;
if(text instanceof Formula) {
Formula formula = (Formula)text;
if(formula.getResult() != null) {
text4Glyph = Utils.objectToString(formula.getResult());
}
} else {
text4Glyph = GeneralUtils.objectToString(text);
}
return new EChartsTitleGlyph(text4Glyph);
}
@Override
public void readXML(XMLableReader reader) {
super.readXML(reader);
if (reader.isChildNode()) {
String name = reader.getTagName();
if ("Attr4ECharts".equals(name)) {
}
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG);
super.writeXML(writer);
writer.startTAG("Attr4ECharts").end();
writer.end();
}
}

4
src/com/fr/solution/plugin/chart/echarts/ui/AbstractEChartsTypePane.java → src/com/fr/solution/plugin/chart/echarts/common/ui/AbstractEChartsTypePane.java

@ -1,11 +1,11 @@
package com.fr.solution.plugin.chart.echarts.ui;
package com.fr.solution.plugin.chart.echarts.common.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 com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import java.util.ArrayList;
import java.util.List;

25
src/com/fr/solution/plugin/chart/echarts/common/ui/AbstractIndependentEChartsUI.java

@ -0,0 +1,25 @@
package com.fr.solution.plugin.chart.echarts.common.ui;
import com.fr.design.chart.fun.impl.AbstractIndependentChartUI;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
/**
* Created by richie on 16/2/18.
*/
public abstract class AbstractIndependentEChartsUI extends AbstractIndependentChartUI {
private EChartsStylePane stylePane;
@Override
public boolean isUseDefaultPane() {
return false;
}
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){
if (stylePane == null) {
stylePane = new EChartsStylePane(listener);
}
return new AbstractChartAttrPane[]{stylePane};
}
}

218
src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsStylePane.java

@ -0,0 +1,218 @@
package com.fr.solution.plugin.chart.echarts.common.ui;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.MultiTabPane;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class EChartsStylePane extends AbstractChartAttrPane implements UIObserver {
private KindOfTabPane kindOfTabPane;
private EChartsTitlePane titlePane;
private BasicPane tooltipPane;
private AttributeChangeListener listener;
private UIObserverListener uiObserverListener;
private ECharts chart;
public EChartsStylePane(AttributeChangeListener listener) {
this.listener = listener;
initComponents();
}
private void initComponents() {
setLayout(new BorderLayout());
titlePane = new EChartsTitlePane(this);
tooltipPane = new BasicPane() {
@Override
protected String title4PopupWindow() {
return "Tooltip";
}
};
}
protected void initSelfListener(Container parentComponent) {
for (int i = 0; i < parentComponent.getComponentCount(); i++) {
Component tmpComp = parentComponent.getComponent(i);
if (tmpComp instanceof Container) {
initListener((Container) tmpComp);
}
if (tmpComp instanceof UIObserver) {
((UIObserver) tmpComp).registerChangeListener(uiObserverListener);
}
}
}
@Override
protected JPanel createContentPane() {
JPanel content = new JPanel(new BorderLayout());
if (chart == null) {
return content;
}
kindOfTabPane = new KindOfTabPane();
content.add(kindOfTabPane, BorderLayout.CENTER);
return content;
}
/**
* 返回对应的图片路径.
*/
public String getIconPath() {
return "com/fr/solution/plugin/chart/echarts/images/toolbar_item.png";
}
@Override
public void populate(ChartCollection collection) {
this.chart = (ECharts) collection.getSelectedChart();
this.remove(leftContentPane);
initContentPane();
this.removeAttributeChangeListener();
kindOfTabPane.populateBean(chart);
this.addAttributeChangeListener(listener);
this.initAllListeners();
}
@Override
public void update(ChartCollection collection) {
kindOfTabPane.updateBean((ECharts) collection.getSelectedChart());
}
/**
* 返回界面的标题名称
*
* @return 返回名称.
*/
public String title4PopupWindow() {
return PaneTitleConstants.CHART_STYLE_TITLE;
}
/**
* 注册事件监听器
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(UIObserverListener listener) {
this.uiObserverListener = listener;
}
/**
* 是否相应事件
*
* @return
*/
public boolean shouldResponseChangeListener() {
return true;
}
/**
* 二级tab组件
*/
public class KindOfTabPane extends MultiTabPane<ECharts> {
@Override
protected void initLayout() {
JPanel tabPanel = new JPanel(new BorderLayout());
tabPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 10, getBackground()));
tabPanel.add(tabPane, BorderLayout.CENTER);
setLayout(new BorderLayout(0, 4));
add(tabPanel, BorderLayout.NORTH);
add(centerPane, BorderLayout.CENTER);
}
@Override
protected void dealWithTabChanged(int index) {
dealWithChosenPane(index);
cardLayout.show(centerPane, NameArray[index]);
tabChanged();
}
private void dealWithChosenPane(int index) {
//第一个总是标题
if (index == 0) {
return;
}
BasicPane chosenPane = paneList.get(index);
centerPane.remove(index);
paneList.remove(index);
/**
* richie:这边的目的是把空的展位面板替换成显示真是数据的面板
*/
if (chosenPane == tooltipPane) {
chosenPane = new EChartsTooltipPane(EChartsStylePane.this);
}
initSelfListener(chosenPane);
centerPane.add(chosenPane, chosenPane.getTitle(), index);
paneList.add(index, chosenPane);
}
@Override
protected void tabChanged() {
EChartsStylePane.this.removeAttributeChangeListener();
((BasicBeanPane<ECharts>) paneList.get(tabPane.getSelectedIndex())).populateBean(chart);
EChartsStylePane.this.addAttributeChangeListener(listener);
}
@Override
protected List<BasicPane> initPaneList() {
java.util.List<BasicPane> paneList = new ArrayList<BasicPane>();
paneList.add(titlePane);
paneList.add(tooltipPane);
return paneList;
}
@Override
public void populateBean(ECharts ob) {
if (chart == null || kindOfTabPane.getSelectedIndex() == -1) {
return;
}
((BasicBeanPane<ECharts>) paneList.get(kindOfTabPane.getSelectedIndex())).populateBean(chart);
}
@Override
public ECharts updateBean() {
if (chart == null) {
return null;
}
((BasicBeanPane<ECharts>) paneList.get(kindOfTabPane.getSelectedIndex())).updateBean(chart);
return chart;
}
@Override
public void updateBean(ECharts ob) {
((BasicBeanPane<ECharts>) paneList.get(kindOfTabPane.getSelectedIndex())).updateBean(ob);
}
@Override
public boolean accept(Object ob) {
return true;
}
@Override
public String title4PopupWindow() {
return "Tab";
}
@Override
public void reset() {
}
}
}

90
src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsTitlePane.java

@ -0,0 +1,90 @@
package com.fr.solution.plugin.chart.echarts.common.ui;
import com.fr.base.Formula;
import com.fr.base.Utils;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.GeneralUtils;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import com.fr.solution.plugin.chart.echarts.common.title.EChartsTitle;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
/**
* Created by richie on 16/2/19.
*/
public class EChartsTitlePane extends BasicScrollPane<ECharts> {
private UIButtonGroup<Boolean> showTitle;
private TinyFormulaPane tinyFormulaPane;
private EChartsStylePane parent;
public EChartsTitlePane(EChartsStylePane parent) {
this.parent = parent;
}
@Override
protected JPanel createContentPane() {
JPanel panel = new JPanel(new BorderLayout());
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
showTitle = new UIButtonGroup<Boolean>(new String[]{"显示", "不显示"}, new Boolean[]{true, false});
showTitle.setSelectedIndex(0);
tinyFormulaPane = new TinyFormulaPane();
JPanel cen = TableLayoutHelper.createTableLayoutPane(new Component[][]{
{new UILabel("显示标题"), showTitle},
{new UILabel("标题内容"), tinyFormulaPane}
}, rowSize, columnSize);
panel.add(cen, BorderLayout.CENTER);
return panel;
}
@Override
public void populateBean(ECharts ob) {
EChartsTitle title = (EChartsTitle) ob.getTitle();
if (title == null) {
return;
}
showTitle.setSelectedItem(title.isTitleVisble());
if (title.getTextObject() instanceof Formula) {
tinyFormulaPane.populateBean(((Formula) title.getTextObject()).getContent());
} else {
tinyFormulaPane.populateBean(GeneralUtils.objectToString(title.getTextObject()));
}
}
@Override
public void updateBean(ECharts ob) {
if (ob == null) {
ob = new ECharts();
}
EChartsTitle title = (EChartsTitle) ob.getTitle();
if (title == null) {
title = new EChartsTitle();
}
title.setTitleVisble(showTitle.getSelectedItem());
String titleString = tinyFormulaPane.updateBean();
Object titleObj;
if (StableUtils.maybeFormula(titleString)) {
titleObj = new Formula(titleString);
} else {
titleObj = titleString;
}
title.setTextObject(titleObj);
}
@Override
protected String title4PopupWindow() {
return "Title";
}
}

31
src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsTooltipPane.java

@ -0,0 +1,31 @@
package com.fr.solution.plugin.chart.echarts.common.ui;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import javax.swing.*;
/**
* Created by richie on 16/2/19.
*/
public class EChartsTooltipPane extends BasicScrollPane<ECharts> {
public EChartsTooltipPane(EChartsStylePane parent) {
}
@Override
protected JPanel createContentPane() {
return new JPanel();
}
@Override
public void populateBean(ECharts ob) {
}
@Override
protected String title4PopupWindow() {
return "Tooltip";
}
}

2
src/com/fr/solution/plugin/chart/echarts/ui/data/AbstractEChartsReportDataContentPane.java → src/com/fr/solution/plugin/chart/echarts/common/ui/data/AbstractEChartsReportDataContentPane.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.ui.data;
package com.fr.solution.plugin.chart.echarts.common.ui.data;
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane;

4
src/com/fr/solution/plugin/chart/echarts/ui/data/AbstractEChartsTableDataContentPane.java → src/com/fr/solution/plugin/chart/echarts/common/ui/data/AbstractEChartsTableDataContentPane.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.ui.data;
package com.fr.solution.plugin.chart.echarts.common.ui.data;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Bar2DPlot;
@ -13,7 +13,7 @@ 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.solution.plugin.chart.echarts.common.ui.series.NewSeriesTypeUsePane;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;

2
src/com/fr/solution/plugin/chart/echarts/ui/filter/NewDataFilterPane.java → src/com/fr/solution/plugin/chart/echarts/common/ui/filter/NewDataFilterPane.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.ui.filter;
package com.fr.solution.plugin.chart.echarts.common.ui.filter;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;

4
src/com/fr/solution/plugin/chart/echarts/ui/series/NewSeriesTypeUsePane.java → src/com/fr/solution/plugin/chart/echarts/common/ui/series/NewSeriesTypeUsePane.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.ui.series;
package com.fr.solution.plugin.chart.echarts.common.ui.series;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.ChartCollection;
@ -14,7 +14,7 @@ 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 com.fr.solution.plugin.chart.echarts.common.ui.filter.NewDataFilterPane;
import javax.swing.*;
import java.awt.*;

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

@ -0,0 +1,374 @@
/**
* Created by richie on 16/1/29.
*/
EChartsFactory = function(options, $dom) {
this.options = options;
this.$dom = $dom;
this.chartID = options.chartID;
this.autoRefreshTime = options.autoRefreshTime || 0;
this.width = options.width || $dom.width();// 补充从dom获取.
this.height = options.height || $dom.height();
this.sheetIndex = options.sheetIndex || 0;
this.ecName = options.ecName || '';
FR.Chart.WebUtils._installChart(this, this.chartID);
};
EChartsFactory.prototype = {
constructor : EChartsFactory,
inits : function() {
var theme = {
// 全图默认背景
backgroundColor: '#1b1b1b',
// 默认色板
color: [
'#FE8463','#9BCA63','#FAD860','#60C0DD','#0084C6',
'#D7504B','#C6E579','#26C0C0','#F0805A','#F4E001',
'#B5C334'
],
// 图表标题
title: {
textStyle: {
fontWeight: 'normal',
color: '#fff' // 主标题文字颜色
}
},
// 图例
legend: {
textStyle: {
color: '#ccc' // 图例文字颜色
}
},
// 值域
dataRange: {
itemWidth: 15,
color: ['#FFF808','#21BCF9'],
textStyle: {
color: '#ccc' // 值域文字颜色
}
},
toolbox: {
color : ['#fff', '#fff', '#fff', '#fff'],
effectiveColor : '#FE8463',
disableColor: '#666'
},
// 提示框
tooltip: {
backgroundColor: 'rgba(250,250,250,0.8)', // 提示背景颜色,默认为透明度为0.7的黑色
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'line', // 默认为直线,可选为:'line' | 'shadow'
lineStyle : { // 直线指示器样式设置
color: '#aaa'
},
crossStyle: {
color: '#aaa'
},
shadowStyle : { // 阴影指示器样式设置
color: 'rgba(200,200,200,0.2)'
}
},
textStyle: {
color: '#333'
}
},
// 区域缩放控制器
dataZoom: {
dataBackgroundColor: '#555', // 数据背景颜色
fillerColor: 'rgba(200,200,200,0.2)', // 填充颜色
handleColor: '#eee' // 手柄颜色
},
// 网格
grid: {
borderWidth: 0
},
// 类目轴
categoryAxis: {
axisLine: { // 坐标轴线
show: false
},
axisTick: { // 坐标轴小标记
show: false
},
axisLabel: { // 坐标轴文本标签,详见axis.axisLabel
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
color: '#ccc'
}
},
splitLine: { // 分隔线
show: false
}
},
// 数值型坐标轴默认参数
valueAxis: {
axisLine: { // 坐标轴线
show: false
},
axisTick: { // 坐标轴小标记
show: false
},
axisLabel: { // 坐标轴文本标签,详见axis.axisLabel
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
color: '#ccc'
}
},
splitLine: { // 分隔线
lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
color: ['#aaa'],
type: 'dashed'
}
},
splitArea: { // 分隔区域
show: false
}
},
polar : {
name : {
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
color: '#ccc'
}
},
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
color: '#ddd'
}
},
splitArea : {
show : true,
areaStyle : {
color: ['rgba(250,250,250,0.2)','rgba(200,200,200,0.2)']
}
},
splitLine : {
lineStyle : {
color : '#ddd'
}
}
},
timeline : {
label: {
textStyle:{
color: '#ccc'
}
},
lineStyle : {
color : '#aaa'
},
controlStyle : {
normal : { color : '#fff'},
emphasis : { color : '#FE8463'}
},
symbolSize : 3
},
// 折线图默认参数
line: {
smooth : true
},
// K线图默认参数
k: {
itemStyle: {
normal: {
color: '#FE8463', // 阳线填充颜色
color0: '#9BCA63', // 阴线填充颜色
lineStyle: {
width: 1,
color: '#FE8463', // 阳线边框颜色
color0: '#9BCA63' // 阴线边框颜色
}
}
}
},
// 雷达图默认参数
radar : {
symbol: 'emptyCircle', // 图形类型
symbolSize:3
//symbol: null, // 拐点图形类型
//symbolRotate : null, // 图形旋转控制
},
pie: {
itemStyle: {
normal: {
borderWidth: 1,
borderColor : 'rgba(255, 255, 255, 0.5)'
},
emphasis: {
borderWidth: 1,
borderColor : 'rgba(255, 255, 255, 1)'
}
}
},
map: {
itemStyle: {
normal: {
borderColor:'rgba(255, 255, 255, 0.5)',
areaStyle: {
color: '#ddd'
},
label: {
textStyle: {
// color: '#ccc'
}
}
},
emphasis: { // 也是选中样式
areaStyle: {
color: '#FE8463'
},
label: {
textStyle: {
// color: 'ccc'
}
}
}
}
},
force : {
itemStyle: {
normal: {
linkStyle : {
color : '#fff'
}
}
}
},
chord : {
itemStyle : {
normal : {
borderWidth: 1,
borderColor: 'rgba(228, 228, 228, 0.2)',
chordStyle : {
lineStyle : {
color : 'rgba(228, 228, 228, 0.2)'
}
}
},
emphasis : {
borderWidth: 1,
borderColor: 'rgba(228, 228, 228, 0.9)',
chordStyle : {
lineStyle : {
color : 'rgba(228, 228, 228, 0.9)'
}
}
}
}
},
gauge : {
axisLine: { // 坐标轴线
show: true, // 默认显示,属性show控制显示与否
lineStyle: { // 属性lineStyle控制线条样式
color: [[0.2, '#9BCA63'],[0.8, '#60C0DD'],[1, '#D7504B']],
width: 3,
shadowColor : '#fff', //默认透明
shadowBlur: 10
}
},
axisTick: { // 坐标轴小标记
length :15, // 属性length控制线长
lineStyle: { // 属性lineStyle控制线条样式
color: 'auto',
shadowColor : '#fff', //默认透明
shadowBlur: 10
}
},
axisLabel: { // 坐标轴小标记
textStyle: { // 属性lineStyle控制线条样式
fontWeight: 'bolder',
color: '#fff',
shadowColor : '#fff', //默认透明
shadowBlur: 10
}
},
splitLine: { // 分隔线
length :25, // 属性length控制线长
lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式
width:3,
color: '#fff',
shadowColor : '#fff', //默认透明
shadowBlur: 10
}
},
pointer: { // 分隔线
shadowColor : '#fff', //默认透明
shadowBlur: 5
},
title : {
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
fontWeight: 'bolder',
fontSize: 20,
fontStyle: 'italic',
color: '#fff',
shadowColor : '#fff', //默认透明
shadowBlur: 10
}
},
detail : {
shadowColor : '#fff', //默认透明
shadowBlur: 5,
offsetCenter: [0, '50%'], // x, y,单位px
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
fontWeight: 'bolder',
color: '#fff'
}
}
},
funnel : {
itemStyle: {
normal: {
borderColor : 'rgba(255, 255, 255, 0.5)',
borderWidth: 1
},
emphasis: {
borderColor : 'rgba(255, 255, 255, 1)',
borderWidth: 1
}
}
},
textStyle: {
fontFamily: '微软雅黑, Arial, Verdana, sans-serif'
}
};
this.newCharts = echarts.init(this.$dom[0], theme);
this.newCharts.setOption(this.options.chartAttr);
},
resize : function() {
this.newCharts.resize();
},
refresh:function() {
},
refreshData:function(options){
},
//数据监控的刷新方式
setData:function(options, aimation){
}
};

0
src/com/fr/solution/plugin/chart/echarts/web/lib/echarts-all.js → src/com/fr/solution/plugin/chart/echarts/common/web/lib/echarts-all.js

0
src/com/fr/solution/plugin/chart/echarts/web/lib/echarts.min.js → src/com/fr/solution/plugin/chart/echarts/common/web/lib/echarts.min.js vendored

25
src/com/fr/solution/plugin/chart/echarts/glyph/EChartsLegendGlyph.java

@ -1,25 +0,0 @@
package com.fr.solution.plugin.chart.echarts.glyph;
import com.fr.chart.chartglyph.LegendGlyph;
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/2.
*/
public class EChartsLegendGlyph extends LegendGlyph {
@Override
public JSONObject toJSONObject(Repository repo) throws JSONException {
return createLegend(repo);
}
private JSONObject createLegend(Repository repo) throws JSONException {
return JSONObject.create()
.put("orient", "vertical")
.put("x", "left")
.put("data", JSONArray.create().put("iPhone3").put("iPhone4").put("iPhone5"));
}
}

26
src/com/fr/solution/plugin/chart/echarts/glyph/pie/EChartsPiePlotGlyph.java

@ -1,26 +0,0 @@
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;
}
}

BIN
src/com/fr/solution/plugin/chart/echarts/images/toolbar_item.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

10
src/com/fr/solution/plugin/chart/echarts/ChineseMap.java → src/com/fr/solution/plugin/chart/echarts/map/ChineseMap.java

@ -1,10 +1,10 @@
package com.fr.solution.plugin.chart.echarts;
package com.fr.solution.plugin.chart.echarts.map;
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.map.ChineseMapPlot;
import com.fr.solution.plugin.chart.echarts.common.base.AbstractIndependentEChartsProvider;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import com.fr.solution.plugin.chart.echarts.map.plot.ChineseMapPlot;
/**
* Created by richie on 16/1/29.
@ -38,7 +38,7 @@ public class ChineseMap extends AbstractIndependentEChartsProvider {
@Override
public String getChartImagePath() {
return "com/fr/solution/plugin/chart/echarts/images/map/map256.png";
return "com/fr/solution/plugin/chart/echarts/map/images/map256.png";
}
}

13
src/com/fr/solution/plugin/chart/echarts/ChineseMapUI.java → src/com/fr/solution/plugin/chart/echarts/map/ChineseMapUI.java

@ -1,15 +1,14 @@
package com.fr.solution.plugin.chart.echarts;
package com.fr.solution.plugin.chart.echarts.map;
import com.fr.chart.chartattr.Plot;
import com.fr.design.chart.fun.impl.AbstractIndependentChartUI;
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;
import com.fr.solution.plugin.chart.echarts.common.ui.AbstractIndependentEChartsUI;
import com.fr.solution.plugin.chart.echarts.map.ui.ChineseMapReportDataContentPane;
import com.fr.solution.plugin.chart.echarts.map.ui.ChineseMapTableDataContentPane;
import com.fr.solution.plugin.chart.echarts.map.ui.ChineseChartTypePane;
/**
* Created by richie on 16/1/29.
@ -32,6 +31,6 @@ public class ChineseMapUI extends AbstractIndependentEChartsUI {
@Override
public String getIconPath() {
return "com/fr/solution/plugin/chart/echarts/images/map/chinese.png";
return "com/fr/solution/plugin/chart/echarts/map/images/chinese.png";
}
}

4
src/com/fr/solution/plugin/chart/echarts/glyph/map/ChineseMapPlotGlyph.java → src/com/fr/solution/plugin/chart/echarts/map/glyph/ChineseMapPlotGlyph.java

@ -1,9 +1,9 @@
package com.fr.solution.plugin.chart.echarts.glyph.map;
package com.fr.solution.plugin.chart.echarts.map.glyph;
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.solution.plugin.chart.echarts.common.glyph.EChartsPlotGlyph;
import com.fr.stable.web.Repository;
/**

0
src/com/fr/solution/plugin/chart/echarts/images/map/chinese.png → src/com/fr/solution/plugin/chart/echarts/map/images/chinese.png

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
src/com/fr/solution/plugin/chart/echarts/images/map/map256.png → src/com/fr/solution/plugin/chart/echarts/map/images/map256.png

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

0
src/com/fr/solution/plugin/chart/echarts/images/map/map_type1.png → src/com/fr/solution/plugin/chart/echarts/map/images/map_type1.png

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

2
src/com/fr/solution/plugin/chart/echarts/monitor/MonitorMap.java → src/com/fr/solution/plugin/chart/echarts/map/monitor/MonitorMap.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.monitor;
package com.fr.solution.plugin.chart.echarts.map.monitor;
import com.fr.general.Inter;
import com.fr.stable.fun.FunctionHelper;

8
src/com/fr/solution/plugin/chart/echarts/plot/map/ChineseMapPlot.java → src/com/fr/solution/plugin/chart/echarts/map/plot/ChineseMapPlot.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.plot.map;
package com.fr.solution.plugin.chart.echarts.map.plot;
import com.fr.base.chart.chartdata.ChartData;
import com.fr.chart.chartattr.Plot;
@ -6,9 +6,9 @@ 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.map.ChineseMapPlotGlyph;
import com.fr.solution.plugin.chart.echarts.monitor.MonitorMap;
import com.fr.solution.plugin.chart.echarts.plot.EChartsPlot;
import com.fr.solution.plugin.chart.echarts.map.glyph.ChineseMapPlotGlyph;
import com.fr.solution.plugin.chart.echarts.map.monitor.MonitorMap;
import com.fr.solution.plugin.chart.echarts.common.plot.EChartsPlot;
import com.fr.stable.fun.FunctionProcessor;
/**

8
src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseChartTypePane.java → src/com/fr/solution/plugin/chart/echarts/map/ui/ChineseChartTypePane.java

@ -1,10 +1,10 @@
package com.fr.solution.plugin.chart.echarts.ui.map;
package com.fr.solution.plugin.chart.echarts.map.ui;
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.plot.map.ChineseMapPlot;
import com.fr.solution.plugin.chart.echarts.map.ChineseMap;
import com.fr.solution.plugin.chart.echarts.map.plot.ChineseMapPlot;
/**
* Created by richie on 16/1/29.
@ -42,7 +42,7 @@ public class ChineseChartTypePane extends UserDefinedChartTypePane {
@Override
protected String[] getTypeIconPath() {
return new String[]{
"/com/fr/solution/plugin/chart/echarts/images/map/map_type1.png"
"/com/fr/solution/plugin/chart/echarts/map/images/map_type1.png"
};
}
}

2
src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseMapReportDataContentPane.java → src/com/fr/solution/plugin/chart/echarts/map/ui/ChineseMapReportDataContentPane.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.ui.map;
package com.fr.solution.plugin.chart.echarts.map.ui;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.event.UIObserver;

4
src/com/fr/solution/plugin/chart/echarts/ui/map/ChineseMapTableDataContentPane.java → src/com/fr/solution/plugin/chart/echarts/map/ui/ChineseMapTableDataContentPane.java

@ -1,7 +1,7 @@
package com.fr.solution.plugin.chart.echarts.ui.map;
package com.fr.solution.plugin.chart.echarts.map.ui;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.solution.plugin.chart.echarts.ui.data.AbstractEChartsTableDataContentPane;
import com.fr.solution.plugin.chart.echarts.common.ui.data.AbstractEChartsTableDataContentPane;
/**
* Created by richie on 16/1/29.

12
src/com/fr/solution/plugin/chart/echarts/EChartsPie.java → src/com/fr/solution/plugin/chart/echarts/pie/EChartsPie.java

@ -1,11 +1,11 @@
package com.fr.solution.plugin.chart.echarts;
package com.fr.solution.plugin.chart.echarts.pie;
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;
import com.fr.solution.plugin.chart.echarts.common.base.AbstractIndependentEChartsProvider;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import com.fr.solution.plugin.chart.echarts.pie.plot.EChartsPiePlot;
import com.fr.solution.plugin.chart.echarts.pie.plot.PieType;
/**
* Created by richie on 16/2/18.
@ -40,6 +40,6 @@ public class EChartsPie extends AbstractIndependentEChartsProvider {
@Override
public String getChartImagePath() {
return "com/fr/solution/plugin/chart/echarts/images/pie/pie256.png";
return "com/fr/solution/plugin/chart/echarts/pie/images/pie256.png";
}
}

12
src/com/fr/solution/plugin/chart/echarts/EChartsPieUI.java → src/com/fr/solution/plugin/chart/echarts/pie/EChartsPieUI.java

@ -1,14 +1,14 @@
package com.fr.solution.plugin.chart.echarts;
package com.fr.solution.plugin.chart.echarts.pie;
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;
import com.fr.solution.plugin.chart.echarts.common.ui.AbstractIndependentEChartsUI;
import com.fr.solution.plugin.chart.echarts.pie.ui.EChartsPieChartTypePane;
import com.fr.solution.plugin.chart.echarts.pie.ui.EChartsPieReportDataContentPane;
import com.fr.solution.plugin.chart.echarts.pie.ui.EChartsPieTableDataContentPane;
/**
* Created by richie on 16/1/29.
@ -32,6 +32,6 @@ public class EChartsPieUI extends AbstractIndependentEChartsUI {
@Override
public String getIconPath() {
return "com/fr/solution/plugin/chart/echarts/images/pie/pie.png";
return "com/fr/solution/plugin/chart/echarts/pie/images/pie.png";
}
}

51
src/com/fr/solution/plugin/chart/echarts/pie/glyph/EChartsPiePlotGlyph.java

@ -0,0 +1,51 @@
package com.fr.solution.plugin.chart.echarts.pie.glyph;
import com.fr.chart.chartglyph.DataPoint;
import com.fr.chart.chartglyph.DataSeries;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONFunction;
import com.fr.json.JSONObject;
import com.fr.solution.plugin.chart.echarts.common.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 result = JSONArray.create();
JSONObject wrapper = JSONObject.create();
result.put(wrapper);
wrapper.put("type", "pie");
wrapper.put("itemStyle",
JSONObject.create().put("normal",
JSONObject.create().put("label",
JSONObject.create().put("formatter", "{c}"))));
JSONArray data = JSONArray.create();
wrapper.put("data", data);
for (int i = 0, len = getSeriesSize(); i < len; i ++) {
DataSeries series = getSeries(i);
String name = series.getSeriesName();
JSONObject item = JSONObject.create();
data.put(item);
item.put("name", name);
if (series.getDataPointCount() > 0) {
DataPoint dataPoint = series.getDataPoint(0);
item.put("value", dataPoint.getValue());
}
}
return result;
}
}

0
src/com/fr/solution/plugin/chart/echarts/images/pie/pie.png → src/com/fr/solution/plugin/chart/echarts/pie/images/pie.png

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
src/com/fr/solution/plugin/chart/echarts/images/pie/pie256.png → src/com/fr/solution/plugin/chart/echarts/pie/images/pie256.png

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

0
src/com/fr/solution/plugin/chart/echarts/images/pie/pie_type1.png → src/com/fr/solution/plugin/chart/echarts/pie/images/pie_type1.png

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

0
src/com/fr/solution/plugin/chart/echarts/images/pie/pie_type2.png → src/com/fr/solution/plugin/chart/echarts/pie/images/pie_type2.png

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

2
src/com/fr/solution/plugin/chart/echarts/monitor/MonitorPie.java → src/com/fr/solution/plugin/chart/echarts/pie/monitor/MonitorPie.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.monitor;
package com.fr.solution.plugin.chart.echarts.pie.monitor;
import com.fr.general.Inter;
import com.fr.stable.fun.FunctionHelper;

8
src/com/fr/solution/plugin/chart/echarts/plot/pie/EChartsPiePlot.java → src/com/fr/solution/plugin/chart/echarts/pie/plot/EChartsPiePlot.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.plot.pie;
package com.fr.solution.plugin.chart.echarts.pie.plot;
import com.fr.base.chart.chartdata.ChartData;
import com.fr.chart.chartattr.Plot;
@ -6,9 +6,9 @@ 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.solution.plugin.chart.echarts.pie.glyph.EChartsPiePlotGlyph;
import com.fr.solution.plugin.chart.echarts.pie.monitor.MonitorPie;
import com.fr.solution.plugin.chart.echarts.common.plot.EChartsPlot;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.FunctionProcessor;
import com.fr.stable.xml.XMLPrintWriter;

2
src/com/fr/solution/plugin/chart/echarts/plot/pie/PieType.java → src/com/fr/solution/plugin/chart/echarts/pie/plot/PieType.java

@ -1,4 +1,4 @@
package com.fr.solution.plugin.chart.echarts.plot.pie;
package com.fr.solution.plugin.chart.echarts.pie.plot;
import com.fr.general.ComparatorUtils;

13
src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieChartTypePane.java → src/com/fr/solution/plugin/chart/echarts/pie/ui/EChartsPieChartTypePane.java

@ -1,12 +1,11 @@
package com.fr.solution.plugin.chart.echarts.ui.pie;
package com.fr.solution.plugin.chart.echarts.pie.ui;
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 com.fr.solution.plugin.chart.echarts.pie.EChartsPie;
import com.fr.solution.plugin.chart.echarts.pie.plot.EChartsPiePlot;
import com.fr.solution.plugin.chart.echarts.common.ui.AbstractEChartsTypePane;
import java.util.ArrayList;
import java.util.List;
@ -60,8 +59,8 @@ public class EChartsPieChartTypePane extends AbstractEChartsTypePane {
@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"
"/com/fr/solution/plugin/chart/echarts/pie/images/pie_type1.png",
"/com/fr/solution/plugin/chart/echarts/pie/images/pie_type2.png"
};
}
}

9
src/com/fr/solution/plugin/chart/echarts/pie/ui/EChartsPieReportDataContentPane.java

@ -0,0 +1,9 @@
package com.fr.solution.plugin.chart.echarts.pie.ui;
import com.fr.solution.plugin.chart.echarts.common.ui.data.AbstractEChartsReportDataContentPane;
/**
* Created by richie on 16/2/18.
*/
public class EChartsPieReportDataContentPane extends AbstractEChartsReportDataContentPane {
}

14
src/com/fr/solution/plugin/chart/echarts/pie/ui/EChartsPieTableDataContentPane.java

@ -0,0 +1,14 @@
package com.fr.solution.plugin.chart.echarts.pie.ui;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.PiePlotTableDataContentPane;
/**
* Created by richie on 16/2/18.
*/
public class EChartsPieTableDataContentPane extends PiePlotTableDataContentPane {
public EChartsPieTableDataContentPane(ChartDataPane parent) {
super(parent);
}
}

16
src/com/fr/solution/plugin/chart/echarts/title/EChartsTitle.java

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

14
src/com/fr/solution/plugin/chart/echarts/ui/AbstractIndependentEChartsUI.java

@ -1,14 +0,0 @@
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;
}
}

9
src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieReportDataContentPane.java

@ -1,9 +0,0 @@
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 {
}

14
src/com/fr/solution/plugin/chart/echarts/ui/pie/EChartsPieTableDataContentPane.java

@ -1,14 +0,0 @@
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);
}
}

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

@ -1,42 +0,0 @@
/**
* Created by richie on 16/1/29.
*/
EChartsFactory = function(options, $dom) {
this.options = options;
this.$dom = $dom;
this.chartID = options.chartID;
this.autoRefreshTime = options.autoRefreshTime || 0;
this.width = options.width || $dom.width();// 补充从dom获取.
this.height = options.height || $dom.height();
this.sheetIndex = options.sheetIndex || 0;
this.ecName = options.ecName || '';
FR.Chart.WebUtils._installChart(this, this.chartID);
};
EChartsFactory.prototype = {
constructor : EChartsFactory,
inits : function() {
this.newCharts = echarts.init(this.$dom[0]);
this.newCharts.setOption(this.options.chartAttr);
},
resize : function() {
this.newCharts.resize();
},
refresh:function() {
},
refreshData:function(options){
},
//数据监控的刷新方式
setData:function(options, aimation){
}
};
Loading…
Cancel
Save