Browse Source

拼写错误

pull/1/head
richie 9 years ago
parent
commit
d94f23df29
  1. 1
      src/com/fr/solution/plugin/chart/echarts/common/EChartsFileLoader.java
  2. 50
      src/com/fr/solution/plugin/chart/echarts/common/base/ECharts.java
  3. 28
      src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsGlyph.java
  4. 4
      src/com/fr/solution/plugin/chart/echarts/common/glyph/EChartsTitleGlyph.java
  5. 60
      src/com/fr/solution/plugin/chart/echarts/common/theme/EChartsTheme.java
  6. 83
      src/com/fr/solution/plugin/chart/echarts/common/tooltip/EChartsTooltip.java
  7. 30
      src/com/fr/solution/plugin/chart/echarts/common/tooltip/TriggerType.java
  8. 35
      src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsLegendPane.java
  9. 26
      src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsStylePane.java
  10. 75
      src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsThemePane.java
  11. 18
      src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsTitlePane.java
  12. 57
      src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsTooltipPane.java
  13. 156
      src/com/fr/solution/plugin/chart/echarts/common/ui/data/AbstractEChartsTableDataContentPane.java
  14. 341
      src/com/fr/solution/plugin/chart/echarts/common/web/echarts.bridge.js
  15. 5
      src/com/fr/solution/plugin/chart/echarts/common/web/echarts.loader.js
  16. 337
      src/com/fr/solution/plugin/chart/echarts/common/web/theme/dark.js
  17. 11
      src/com/fr/solution/plugin/chart/echarts/locale/echarts.properties
  18. 11
      src/com/fr/solution/plugin/chart/echarts/locale/echarts_zh_CN.properties
  19. 57
      src/com/fr/solution/plugin/chart/echarts/pie/glyph/EChartsPiePlotGlyph.java
  20. 4
      src/com/fr/solution/plugin/chart/echarts/pie/ui/EChartsPieTableDataContentPane.java

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

@ -10,6 +10,7 @@ public class EChartsFileLoader extends AbstractJavaScriptFileHandler {
@Override @Override
public String[] pathsForFiles() { public String[] pathsForFiles() {
return new String[]{ return new String[]{
"/com/fr/solution/plugin/chart/echarts/common/web/echarts.loader.js",
"/com/fr/solution/plugin/chart/echarts/common/web/lib/echarts-all.js" "/com/fr/solution/plugin/chart/echarts/common/web/lib/echarts-all.js"
}; };
} }

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

@ -16,7 +16,9 @@ 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.EChartsLegendGlyph;
import com.fr.solution.plugin.chart.echarts.common.glyph.EChartsTitleGlyph; 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.plot.EChartsPlot;
import com.fr.solution.plugin.chart.echarts.common.theme.EChartsTheme;
import com.fr.solution.plugin.chart.echarts.common.title.EChartsTitle; import com.fr.solution.plugin.chart.echarts.common.title.EChartsTitle;
import com.fr.solution.plugin.chart.echarts.common.tooltip.EChartsTooltip;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
@ -26,16 +28,35 @@ import com.fr.stable.xml.XMLableReader;
*/ */
public class ECharts extends Chart { public class ECharts extends Chart {
private EChartsTheme theme;
private EChartsTooltip tooltip;
public ECharts() { public ECharts() {
setWrapperName("EChartsFactory"); this(null);
setTitle(new EChartsTitle());
} }
public ECharts(EChartsPlot plot) { public ECharts(EChartsPlot plot) {
super(plot); super(plot);
setWrapperName("EChartsFactory"); setWrapperName("EChartsFactory");
setTitle(new EChartsTitle()); setTitle(new EChartsTitle());
setTooltip(new EChartsTooltip());
}
public EChartsTheme getTheme() {
return theme;
}
public void setTheme(EChartsTheme theme) {
this.theme = theme;
}
public EChartsTooltip getTooltip() {
return tooltip;
}
public void setTooltip(EChartsTooltip tooltip) {
this.tooltip = tooltip;
} }
@Override @Override
@ -60,6 +81,13 @@ public class ECharts extends Chart {
glyph.setRequiredJS(getRequiredJS()); glyph.setRequiredJS(getRequiredJS());
glyph.setJSDraw(isJSDraw()); glyph.setJSDraw(isJSDraw());
if (theme != null) {
glyph.setTheme(theme);
}
if (tooltip != null) {
glyph.setTooltip(tooltip);
}
return glyph; return glyph;
} }
@ -92,6 +120,10 @@ public class ECharts extends Chart {
setFilterDefinition(readDefinition(reader)); setFilterDefinition(readDefinition(reader));
} }
}); });
} else if (tmpNodeName.equals(EChartsTheme.XML_TAG)) {
theme = (EChartsTheme) GeneralXMLTools.readXMLable(reader);
} else if (tmpNodeName.equals(EChartsTooltip.XML_TAG)) {
tooltip = (EChartsTooltip) GeneralXMLTools.readXMLable(reader);
} }
} }
} }
@ -118,5 +150,19 @@ public class ECharts extends Chart {
@Override @Override
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
super.writeXML(writer); super.writeXML(writer);
if (theme != null) {
GeneralXMLTools.writeXMLable(writer, theme, EChartsTheme.XML_TAG);
}
if (tooltip != null) {
GeneralXMLTools.writeXMLable(writer, tooltip, EChartsTooltip.XML_TAG);
}
}
@Override
public boolean equals(Object ob) {
return ob instanceof ECharts
&& super.equals(ob)
&& ComparatorUtils.equals(theme, ((ECharts) ob).theme)
&& ComparatorUtils.equals(tooltip, ((ECharts) ob).tooltip);
} }
} }

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

@ -4,6 +4,9 @@ import com.fr.chart.chartglyph.ChartGlyph;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.solution.plugin.chart.echarts.common.theme.EChartsTheme;
import com.fr.solution.plugin.chart.echarts.common.tooltip.EChartsTooltip;
import com.fr.stable.StringUtils;
import com.fr.stable.web.Repository; import com.fr.stable.web.Repository;
/** /**
@ -11,6 +14,17 @@ import com.fr.stable.web.Repository;
*/ */
public class EChartsGlyph extends ChartGlyph { public class EChartsGlyph extends ChartGlyph {
private EChartsTheme theme;
private EChartsTooltip tooltip;
public void setTheme(EChartsTheme theme) {
this.theme = theme;
}
public void setTooltip(EChartsTooltip tooltip) {
this.tooltip = tooltip;
}
@Override @Override
public JSONObject toJSONObject(Repository repo) throws JSONException { public JSONObject toJSONObject(Repository repo) throws JSONException {
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
@ -18,7 +32,7 @@ public class EChartsGlyph extends ChartGlyph {
if (titleGlyph != null) { if (titleGlyph != null) {
jo.put("title", titleGlyph.toJSONObject(repo)); jo.put("title", titleGlyph.toJSONObject(repo));
} }
jo.put("tooltip", createTooltip(repo));
EChartsLegendGlyph legendGlyph = (EChartsLegendGlyph) getLegendGlyph(); EChartsLegendGlyph legendGlyph = (EChartsLegendGlyph) getLegendGlyph();
if (legendGlyph != null) { if (legendGlyph != null) {
@ -28,12 +42,12 @@ public class EChartsGlyph extends ChartGlyph {
if (plotGlyph != null) { if (plotGlyph != null) {
jo.put("series", plotGlyph.toSeriesData(repo)); jo.put("series", plotGlyph.toSeriesData(repo));
} }
if (theme != null) {
jo.put("theme", theme.getName());
}
if (tooltip != null) {
jo.put("tooltip", tooltip.toJSONObject(repo));
}
return jo; return jo;
} }
private JSONObject createTooltip(Repository repo) throws JSONException {
return JSONObject.create()
.put("trigger", "item");
}
} }

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

@ -21,8 +21,10 @@ public class EChartsTitleGlyph extends TitleGlyph {
} }
private JSONObject createTitle(Repository repo) throws JSONException { private JSONObject createTitle(Repository repo) throws JSONException {
return JSONObject.create() JSONObject t = JSONObject.create()
.put("text", getText()) .put("text", getText())
.put("x", "center"); .put("x", "center");
return t;
} }
} }

60
src/com/fr/solution/plugin/chart/echarts/common/theme/EChartsTheme.java

@ -0,0 +1,60 @@
package com.fr.solution.plugin.chart.echarts.common.theme;
import com.fr.general.ComparatorUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
/**
* Created by richie on 16/2/22.
*/
public class EChartsTheme implements XMLable {
public static final String XML_TAG = "Theme";
private String name;
public EChartsTheme() {
this("default");
}
public EChartsTheme(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object obj) {
return obj instanceof EChartsTheme
&& ComparatorUtils.equals(name, ((EChartsTheme) obj).name);
}
@Override
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if (tagName.equals("ThemeAttr")) {
name = reader.getAttrAsString("name", "default");
}
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("ThemeAttr");
writer.attr("name", name);
writer.end();
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}

83
src/com/fr/solution/plugin/chart/echarts/common/tooltip/EChartsTooltip.java

@ -0,0 +1,83 @@
package com.fr.solution.plugin.chart.echarts.common.tooltip;
import com.fr.general.ComparatorUtils;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
import com.fr.stable.web.Repository;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
/**
* Created by richie on 16/2/22.
*/
public class EChartsTooltip implements XMLable {
public static final String XML_TAG = "Tooltip";
private TriggerType triggerType;
private String format;
public EChartsTooltip() {
}
public TriggerType getTriggerType() {
return triggerType;
}
public void setTriggerType(TriggerType triggerType) {
this.triggerType = triggerType;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public JSONObject toJSONObject(Repository repo) throws JSONException {
JSONObject jo = JSONObject.create();
jo.put("trigger", triggerType.getType());
jo.put("formatter", format);
return jo;
}
@Override
public boolean equals(Object obj) {
return obj instanceof EChartsTooltip
&& ComparatorUtils.equals(triggerType, ((EChartsTooltip) obj).triggerType)
&& ComparatorUtils.equals(format, ((EChartsTooltip) obj).format);
}
@Override
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if (tagName.equals("Attr")) {
triggerType = TriggerType.parse(reader.getAttrAsString("trigger", ""));
format = reader.getAttrAsString("format", "");
}
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG("Attr");
if (triggerType != null) {
writer.attr("trigger", triggerType.getType());
}
if (StringUtils.isNotEmpty(format)) {
writer.attr("format", format);
}
writer.end();
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}

30
src/com/fr/solution/plugin/chart/echarts/common/tooltip/TriggerType.java

@ -0,0 +1,30 @@
package com.fr.solution.plugin.chart.echarts.common.tooltip;
import com.fr.general.ComparatorUtils;
/**
* Created by richie on 16/2/22.
*/
public enum TriggerType {
ITEM("item"), AXIS("axis");
private String type;
TriggerType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public static TriggerType parse(String type) {
for (TriggerType tt : values()) {
if (ComparatorUtils.equals(type, tt.type)) {
return tt;
}
}
return ITEM;
}
}

35
src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsLegendPane.java

@ -0,0 +1,35 @@
package com.fr.solution.plugin.chart.echarts.common.ui;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import javax.swing.*;
import java.awt.*;
/**
* Created by richie on 16/2/22.
*/
public class EChartsLegendPane extends BasicScrollPane<ECharts> {
public EChartsLegendPane(EChartsStylePane parent) {
}
@Override
protected JPanel createContentPane() {
JPanel panel = new JPanel(new BorderLayout());
panel.add(new UILabel("待开发", SwingConstants.CENTER), BorderLayout.CENTER);
return panel;
}
@Override
public void populateBean(ECharts ob) {
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Plugin-ECharts_Legend");
}
}

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

@ -9,6 +9,7 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts; import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import javax.swing.*; import javax.swing.*;
@ -23,6 +24,8 @@ public class EChartsStylePane extends AbstractChartAttrPane implements UIObserve
private EChartsTitlePane titlePane; private EChartsTitlePane titlePane;
private BasicPane tooltipPane; private BasicPane tooltipPane;
private BasicPane themePane;
private BasicPane legendPane;
private AttributeChangeListener listener; private AttributeChangeListener listener;
private UIObserverListener uiObserverListener; private UIObserverListener uiObserverListener;
@ -39,7 +42,19 @@ public class EChartsStylePane extends AbstractChartAttrPane implements UIObserve
tooltipPane = new BasicPane() { tooltipPane = new BasicPane() {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "Tooltip"; return Inter.getLocText("Plugin-ECharts_Tooltip");
}
};
themePane = new BasicPane() {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Plugin-ECharts_Theme");
}
};
legendPane = new BasicPane() {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Plugin-ECharts_Legend");
} }
}; };
} }
@ -156,6 +171,10 @@ public class EChartsStylePane extends AbstractChartAttrPane implements UIObserve
*/ */
if (chosenPane == tooltipPane) { if (chosenPane == tooltipPane) {
chosenPane = new EChartsTooltipPane(EChartsStylePane.this); chosenPane = new EChartsTooltipPane(EChartsStylePane.this);
} else if (chosenPane == themePane) {
chosenPane = new EChartsThemePane(EChartsStylePane.this);
} else if (chosenPane == legendPane) {
chosenPane = new EChartsLegendPane(EChartsStylePane.this);
} }
initSelfListener(chosenPane); initSelfListener(chosenPane);
@ -175,6 +194,8 @@ public class EChartsStylePane extends AbstractChartAttrPane implements UIObserve
java.util.List<BasicPane> paneList = new ArrayList<BasicPane>(); java.util.List<BasicPane> paneList = new ArrayList<BasicPane>();
paneList.add(titlePane); paneList.add(titlePane);
paneList.add(tooltipPane); paneList.add(tooltipPane);
paneList.add(themePane);
paneList.add(legendPane);
return paneList; return paneList;
} }
@ -197,7 +218,8 @@ public class EChartsStylePane extends AbstractChartAttrPane implements UIObserve
@Override @Override
public void updateBean(ECharts ob) { public void updateBean(ECharts ob) {
((BasicBeanPane<ECharts>) paneList.get(kindOfTabPane.getSelectedIndex())).updateBean(ob); BasicBeanPane<ECharts> pane = ((BasicBeanPane<ECharts>) paneList.get(kindOfTabPane.getSelectedIndex()));
pane.updateBean(ob);
} }
@Override @Override

75
src/com/fr/solution/plugin/chart/echarts/common/ui/EChartsThemePane.java

@ -0,0 +1,75 @@
package com.fr.solution.plugin.chart.echarts.common.ui;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.icombobox.UIDictionaryComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import com.fr.solution.plugin.chart.echarts.common.theme.EChartsTheme;
import javax.swing.*;
import java.awt.*;
/**
* Created by richie on 16/2/22.
*/
public class EChartsThemePane extends BasicScrollPane<ECharts> {
private static final String[] themes = new String[]{"default", "dark"};
private UIDictionaryComboBox<String> themeComboBox;
public EChartsThemePane(EChartsStylePane stylePane) {
}
@Override
protected JPanel createContentPane() {
JPanel panel = new JPanel(new BorderLayout());
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p};
double[] columnSize = {p, f};
UILabel titleLabel = new UILabel(Inter.getLocText("Plugin-ECharts_Theme_Select"));
themeComboBox = new UIDictionaryComboBox<String>(
new String[]{"default", "dark"},
new String[]{"默认", "暗黑"});
JPanel cen = TableLayoutHelper.createTableLayoutPane(new Component[][] {
{titleLabel, themeComboBox}
},rowSize, columnSize);
panel.add(cen, BorderLayout.CENTER);
return panel;
}
@Override
public void populateBean(ECharts ob) {
if (ob == null) {
return;
}
EChartsTheme theme = ob.getTheme();
if (theme != null) {
themeComboBox.setSelectedItem(theme.getName());
}
}
@Override
public void updateBean(ECharts ob) {
if (ob == null) {
ob = new ECharts();
}
EChartsTheme theme = new EChartsTheme();
theme.setName(themeComboBox.getSelectedItem());
ob.setTheme(theme);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Plugin-ECharts_Theme");
}
}

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

@ -1,7 +1,6 @@
package com.fr.solution.plugin.chart.echarts.common.ui; package com.fr.solution.plugin.chart.echarts.common.ui;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Utils;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
@ -9,6 +8,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts; import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import com.fr.solution.plugin.chart.echarts.common.title.EChartsTitle; import com.fr.solution.plugin.chart.echarts.common.title.EChartsTitle;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -38,12 +38,16 @@ public class EChartsTitlePane extends BasicScrollPane<ECharts> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
showTitle = new UIButtonGroup<Boolean>(new String[]{"显示", "不显示"}, new Boolean[]{true, false}); showTitle = new UIButtonGroup<Boolean>(
new String[]{
Inter.getLocText("Plugin-ECharts_Title_Show"),
Inter.getLocText("Plugin-ECharts_Title_Not_Show")},
new Boolean[]{true, false});
showTitle.setSelectedIndex(0); showTitle.setSelectedIndex(0);
tinyFormulaPane = new TinyFormulaPane(); tinyFormulaPane = new TinyFormulaPane();
JPanel cen = TableLayoutHelper.createTableLayoutPane(new Component[][]{ JPanel cen = TableLayoutHelper.createTableLayoutPane(new Component[][]{
{new UILabel("显示标题"), showTitle}, {new UILabel(Inter.getLocText("Plugin-ECharts_Title_Show_Label")), showTitle},
{new UILabel("标题内容"), tinyFormulaPane} {new UILabel(Inter.getLocText("Plugin-ECharts_Title_Content")), tinyFormulaPane}
}, rowSize, columnSize); }, rowSize, columnSize);
panel.add(cen, BorderLayout.CENTER); panel.add(cen, BorderLayout.CENTER);
return panel; return panel;
@ -55,7 +59,7 @@ public class EChartsTitlePane extends BasicScrollPane<ECharts> {
if (title == null) { if (title == null) {
return; return;
} }
showTitle.setSelectedItem(title.isTitleVisble()); showTitle.setSelectedItem(title.isTitleVisible());
if (title.getTextObject() instanceof Formula) { if (title.getTextObject() instanceof Formula) {
tinyFormulaPane.populateBean(((Formula) title.getTextObject()).getContent()); tinyFormulaPane.populateBean(((Formula) title.getTextObject()).getContent());
} else { } else {
@ -72,7 +76,7 @@ public class EChartsTitlePane extends BasicScrollPane<ECharts> {
if (title == null) { if (title == null) {
title = new EChartsTitle(); title = new EChartsTitle();
} }
title.setTitleVisble(showTitle.getSelectedItem()); title.setTitleVisible(showTitle.getSelectedItem());
String titleString = tinyFormulaPane.updateBean(); String titleString = tinyFormulaPane.updateBean();
Object titleObj; Object titleObj;
if (StableUtils.maybeFormula(titleString)) { if (StableUtils.maybeFormula(titleString)) {
@ -85,6 +89,6 @@ public class EChartsTitlePane extends BasicScrollPane<ECharts> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "Title"; return Inter.getLocText("Plugin-ECharts_Title");
} }
} }

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

@ -1,31 +1,84 @@
package com.fr.solution.plugin.chart.echarts.common.ui; package com.fr.solution.plugin.chart.echarts.common.ui;
import com.fr.design.dialog.BasicScrollPane; import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.icombobox.UIDictionaryComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.common.base.ECharts; import com.fr.solution.plugin.chart.echarts.common.base.ECharts;
import com.fr.solution.plugin.chart.echarts.common.tooltip.EChartsTooltip;
import com.fr.solution.plugin.chart.echarts.common.tooltip.TriggerType;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
/** /**
* Created by richie on 16/2/19. * Created by richie on 16/2/19.
*/ */
public class EChartsTooltipPane extends BasicScrollPane<ECharts> { public class EChartsTooltipPane extends BasicScrollPane<ECharts> {
private UIDictionaryComboBox<TriggerType> triggerComboBox;
private UITextField formatterTextField;
public EChartsTooltipPane(EChartsStylePane parent) { public EChartsTooltipPane(EChartsStylePane parent) {
} }
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
return new JPanel(); JPanel panel = new JPanel();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
UILabel titleLabel = new UILabel("触发点");
triggerComboBox = new UIDictionaryComboBox<TriggerType>(
new TriggerType[]{TriggerType.ITEM, TriggerType.AXIS},
new String[]{"图例", "坐标轴"});
UILabel formatterLabel = new UILabel("显示格式");
formatterTextField = new UITextField(12);
JPanel cen = TableLayoutHelper.createTableLayoutPane(new Component[][] {
{titleLabel, triggerComboBox},
{formatterLabel, formatterTextField}
},rowSize, columnSize);
panel.add(cen, BorderLayout.CENTER);
return panel;
} }
@Override @Override
public void populateBean(ECharts ob) { public void populateBean(ECharts ob) {
if (ob == null) {
return;
}
EChartsTooltip tooltip = ob.getTooltip();
if (tooltip == null) {
return;
}
triggerComboBox.setSelectedItem(tooltip.getTriggerType());
formatterTextField.setText(tooltip.getFormat());
}
@Override
public void updateBean(ECharts ob) {
if (ob == null) {
ob = new ECharts();
}
EChartsTooltip tooltip = new EChartsTooltip();
tooltip.setTriggerType(triggerComboBox.getSelectedItem());
tooltip.setFormat(formatterTextField.getText());
ob.setTooltip(tooltip);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "Tooltip"; return Inter.getLocText("Plugin-ECharts_Tooltip");
} }
} }

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

@ -1,164 +1,14 @@
package com.fr.solution.plugin.chart.echarts.common.ui.data; package com.fr.solution.plugin.chart.echarts.common.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.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.solution.plugin.chart.echarts.common.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. * Created by richie on 16/1/29.
*/ */
public class AbstractEChartsTableDataContentPane extends AbstractTableDataContentPane { public class AbstractEChartsTableDataContentPane extends CategoryPlotTableDataContentPane {
protected UIComboBox categoryComboBox;
protected NewSeriesTypeUsePane seriesTypeUsePane;
public AbstractEChartsTableDataContentPane(ChartDataPane parent) { public AbstractEChartsTableDataContentPane(ChartDataPane parent) {
super(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());
}
} }

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

@ -20,340 +20,13 @@ EChartsFactory.prototype = {
constructor : EChartsFactory, constructor : EChartsFactory,
inits : function() { inits : function() {
var theme = { debugger;
// 全图默认背景 var ct = this.options.chartAttr;
backgroundColor: '#1b1b1b', if (ct.theme != 'default') {
FR.$defaultImport('/com/fr/solution/plugin/chart/echarts/common/web/theme/' + ct.theme + '.js');
// 默认色板 }
color: [ this.newCharts = echarts.init(this.$dom[0], EChartsTheme[ct.theme]);
'#FE8463','#9BCA63','#FAD860','#60C0DD','#0084C6', this.newCharts.setOption(ct);
'#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() { resize : function() {

5
src/com/fr/solution/plugin/chart/echarts/common/web/echarts.loader.js

@ -0,0 +1,5 @@
(function(){
if (!window.EChartsTheme) {
window.EChartsTheme = {};
}
})();

337
src/com/fr/solution/plugin/chart/echarts/common/web/theme/dark.js

@ -0,0 +1,337 @@
(function(){
$.extend(window.EChartsTheme, {
dark : {
// 全图默认背景
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'
}
}
});
})();

11
src/com/fr/solution/plugin/chart/echarts/locale/echarts.properties

@ -1,2 +1,11 @@
Plugin-ECharts_Chinese_Map=Chinese Map Plugin-ECharts_Chinese_Map=Chinese Map
Plugin-ECharts_Pie=Pie(ECharts) Plugin-ECharts_Pie=Pie(ECharts)
Plugin-ECharts_Title=Title
Plugin-ECharts_Title_Show=Show Title
Plugin-ECharts_Title_Not_Show=Hide Title
Plugin-ECharts_Title_Show_Label=Show Title
Plugin-ECharts_Title_Content=Content
Plugin-ECharts_Tooltip=Theme
Plugin-ECharts_Theme=Theme
Plugin-ECharts_Theme_Select=Select Theme
Plugin-ECharts_Legend=Legend

11
src/com/fr/solution/plugin/chart/echarts/locale/echarts_zh_CN.properties

@ -1,2 +1,11 @@
Plugin-ECharts_Chinese_Map=\u4E2D\u56FD\u5730\u56FE Plugin-ECharts_Chinese_Map=\u4E2D\u56FD\u5730\u56FE
Plugin-ECharts_Pie=\u997C\u56FE(ECharts) Plugin-ECharts_Pie=\u997C\u56FE(ECharts)
Plugin-ECharts_Title=\u6807\u9898
Plugin-ECharts_Title_Show=\u663E\u793A
Plugin-ECharts_Title_Not_Show=\u4E0D\u663E\u793A
Plugin-ECharts_Title_Show_Label=\u663E\u793A\u6807\u9898
Plugin-ECharts_Title_Content=\u6807\u9898\u5185\u5BB9
Plugin-ECharts_Tooltip=\u6807\u7B7E
Plugin-ECharts_Theme=\u4E3B\u9898
Plugin-ECharts_Theme_Select=\u4E3B\u9898\u9009\u62E9
Plugin-ECharts_Legend=\u56FE\u4F8B

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

@ -10,11 +10,16 @@ import com.fr.solution.plugin.chart.echarts.common.glyph.EChartsPlotGlyph;
import com.fr.solution.plugin.chart.echarts.pie.plot.RoseType; import com.fr.solution.plugin.chart.echarts.pie.plot.RoseType;
import com.fr.stable.web.Repository; import com.fr.stable.web.Repository;
import java.text.DecimalFormat;
import java.text.NumberFormat;
/** /**
* Created by richie on 16/2/18. * Created by richie on 16/2/18.
*/ */
public class EChartsPiePlotGlyph extends EChartsPlotGlyph { public class EChartsPiePlotGlyph extends EChartsPlotGlyph {
private static final NumberFormat format = new DecimalFormat("##%");
private RoseType roseType; private RoseType roseType;
public EChartsPiePlotGlyph() { public EChartsPiePlotGlyph() {
@ -37,27 +42,41 @@ public class EChartsPiePlotGlyph extends EChartsPlotGlyph {
public JSONArray toSeriesData(Repository repo) throws JSONException { public JSONArray toSeriesData(Repository repo) throws JSONException {
JSONArray result = JSONArray.create(); JSONArray result = JSONArray.create();
JSONObject wrapper = JSONObject.create(); int cn = getCategoryCount();
result.put(wrapper); String r = "100%";
wrapper.put("type", "pie"); if (cn > 1) {
wrapper.put("roseType", roseType.toTypeString()); r = format.format(1.0 / (cn + 1));
wrapper.put("itemStyle", }
JSONObject.create().put("normal", for (int c = 0; c < cn; c++) {
JSONObject.create().put("label", JSONObject wrapper = JSONObject.create();
JSONObject.create().put("formatter", "{c}")))); result.put(wrapper);
JSONArray data = JSONArray.create(); wrapper.put("type", "pie");
wrapper.put("data", data); if (cn > 1) {
for (int i = 0, len = getSeriesSize(); i < len; i ++) { wrapper.put("radius", r);
DataSeries series = getSeries(i); wrapper.put("center", JSONArray.create().put(format.format(1.0 * c / (cn + 1) + 0.20)).put("55%"));
String name = series.getSeriesName(); }
JSONObject item = JSONObject.create(); wrapper.put("roseType", roseType.toTypeString());
data.put(item); wrapper.put("itemStyle",
item.put("name", name); JSONObject.create().put("normal",
if (series.getDataPointCount() > 0) { JSONObject.create().put("label",
DataPoint dataPoint = series.getDataPoint(0); JSONObject.create().put("formatter", "{c}"))));
item.put("value", dataPoint.getValue()); 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(c);
item.put("value", dataPoint.getValue());
wrapper.put("name", dataPoint.getCategoryName());
}
} }
} }
return result; return result;
} }
} }

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

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

Loading…
Cancel
Save