Browse Source

数据添加接口 对某个字段添加汇总方式

master
zheng 6 years ago
parent
commit
584a62b9a8
  1. 5
      src/com/fr/plugin/demo/DemoChart.java
  2. 34
      src/com/fr/plugin/demo/DemoDataConfig.java
  3. 35
      src/com/fr/plugin/demo/DemoTableDataPane.java

5
src/com/fr/plugin/demo/DemoChart.java

@ -134,7 +134,10 @@ public class DemoChart extends AbstractChart<DemoDataConfig>{
List<Object> yValues = dataConfig.getY().getValues();
List<Object> zValues = dataConfig.getZ().getValues();
jsonObject.put("targetName", dataConfig.getTargetName());
// jsonObject.put("targetName", dataConfig.getTargetName());
List<Object> expectList = dataConfig.getExpect().getValues();
List<Object> actualList = dataConfig.getActual().getValues();
for (int i = 0, len = xValues.size(); i < len; i++) {
maxValue = Math.max(GeneralUtils.objectToNumber(zValues.get(i)).doubleValue(), maxValue);

34
src/com/fr/plugin/demo/DemoDataConfig.java

@ -16,6 +16,9 @@ public class DemoDataConfig extends AbstractDataConfig {
private ExtendedField y = new ExtendedField();
private ExtendedField z = new ExtendedField();
private ExtendedField expect = new ExtendedField();
private ExtendedField actual = new ExtendedField();
public ExtendedField getX() {
return x;
}
@ -48,12 +51,30 @@ public class DemoDataConfig extends AbstractDataConfig {
this.targetName = targetName;
}
public ExtendedField getExpect() {
return expect;
}
public void setExpect(ExtendedField expect) {
this.expect = expect;
}
public ExtendedField getActual() {
return actual;
}
public void setActual(ExtendedField actual) {
this.actual = actual;
}
@Override
protected void readAttr(XMLableReader reader) {
readExtendedField(x, "x", reader);
this.setTargetName(reader.getAttrAsString("targetName", ""));
readExtendedField(y, "y", reader);
readExtendedField(z, "z", reader);
readExtendedField(expect, "expect", reader);
readExtendedField(actual, "actual", reader);
}
@Override
@ -62,6 +83,8 @@ public class DemoDataConfig extends AbstractDataConfig {
writer.attr("targetName", this.getTargetName());
writeExtendedField(y, "y", writer);
writeExtendedField(z, "z", writer);
writeExtendedField(expect, "expect", writer);
writeExtendedField(actual, "actual", writer);
}
@Override
@ -69,7 +92,9 @@ public class DemoDataConfig extends AbstractDataConfig {
return new ExtendedField[]{
x,
y,
z
z,
expect,
actual
};
}
@ -80,12 +105,15 @@ public class DemoDataConfig extends AbstractDataConfig {
result.setTargetName(this.getTargetName());
result.setY(this.getY().clone());
result.setZ(this.getZ().clone());
result.setExpect(this.getExpect().clone());
result.setActual(this.getActual().clone());
return result;
}
@Override
public int hashCode() {
return super.hashCode() + AssistUtils.hashCode(this.getX(), this.getY(), this.getZ(), this.getTargetName());
return super.hashCode() + AssistUtils.hashCode(this.getX(), this.getY(), this.getZ(),
this.getTargetName(), this.getExpect(), this.getActual());
}
@Override
@ -95,6 +123,8 @@ public class DemoDataConfig extends AbstractDataConfig {
&& AssistUtils.equals(this.getTargetName(), ((DemoDataConfig) obj).getTargetName())
&& AssistUtils.equals(this.getY(), ((DemoDataConfig) obj).getY())
&& AssistUtils.equals(this.getZ(), ((DemoDataConfig) obj).getZ())
&& AssistUtils.equals(this.getExpect(), ((DemoDataConfig) obj).getExpect())
&& AssistUtils.equals(this.getActual(), ((DemoDataConfig) obj).getActual())
;
}
}

35
src/com/fr/plugin/demo/DemoTableDataPane.java

@ -2,6 +2,7 @@ package com.fr.plugin.demo;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.extended.chart.AbstractExtendedChartTableDataPane;
import java.awt.Component;
@ -15,13 +16,23 @@ public class DemoTableDataPane extends AbstractExtendedChartTableDataPane<DemoDa
private UIComboBox yComboBox;
private UIComboBox zComboBox;
private UIComboBox expect;
private CalculateComboBox expectFunction;
private UIComboBox actual;
private CalculateComboBox actualFunction;
@Override
protected String[] fieldLabels() {
return new String[]{
"X轴",
"指标名",
"Y轴",
"Z轴"
"Z轴",
// "预期值",
// "预期汇总方式",
// "实际值",
// "实际汇总方式"
};
}
@ -32,12 +43,20 @@ public class DemoTableDataPane extends AbstractExtendedChartTableDataPane<DemoDa
targetName = new UITextField();
yComboBox = new UIComboBox();
zComboBox = new UIComboBox();
expect = new UIComboBox();
expectFunction = new CalculateComboBox();
actual = new UIComboBox();
actualFunction = new CalculateComboBox();
}
return new Component[]{
xComboBox,
targetName,
yComboBox,
zComboBox
zComboBox,
expect,
expectFunction,
actual,
actualFunction
};
}
@ -47,11 +66,15 @@ public class DemoTableDataPane extends AbstractExtendedChartTableDataPane<DemoDa
xComboBox = new UIComboBox();
yComboBox = new UIComboBox();
zComboBox = new UIComboBox();
expect = new UIComboBox();
actual = new UIComboBox();
}
return new UIComboBox[]{
xComboBox,
yComboBox,
zComboBox
zComboBox,
expect,
actual
};
}
@ -61,6 +84,9 @@ public class DemoTableDataPane extends AbstractExtendedChartTableDataPane<DemoDa
targetName.setText(dataConf.getTargetName());
populateField(yComboBox, dataConf.getY());
populateField(zComboBox, dataConf.getZ());
populateFunctionField(expect, expectFunction, dataConf.getExpect());
populateFunctionField(actual, actualFunction, dataConf.getActual());
}
@Override
@ -72,6 +98,9 @@ public class DemoTableDataPane extends AbstractExtendedChartTableDataPane<DemoDa
updateField(yComboBox, dataConfig.getY());
updateField(zComboBox, dataConfig.getZ());
updateFunctionField(expect, expectFunction, dataConfig.getExpect());
updateFunctionField(actual, actualFunction, dataConfig.getActual());
return dataConfig;
}
}

Loading…
Cancel
Save