|
|
|
@ -2,18 +2,30 @@ package com.fr.van.chart.designer.other;
|
|
|
|
|
|
|
|
|
|
import com.fr.chart.chartattr.Chart; |
|
|
|
|
import com.fr.chart.chartattr.Plot; |
|
|
|
|
import com.fr.chart.chartglyph.ConditionAttr; |
|
|
|
|
import com.fr.chart.chartglyph.ConditionCollection; |
|
|
|
|
import com.fr.chartx.attr.LargeDataAttribute; |
|
|
|
|
import com.fr.chartx.attr.LargeDataModeType; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
|
import com.fr.design.gui.ibutton.UIToggleButton; |
|
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
|
|
|
|
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
|
|
|
|
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; |
|
|
|
|
import com.fr.plugin.chart.axis.type.AxisPlotType; |
|
|
|
|
import com.fr.plugin.chart.base.AttrEffect; |
|
|
|
|
import com.fr.plugin.chart.base.AttrLabel; |
|
|
|
|
import com.fr.plugin.chart.base.RefreshMoreLabel; |
|
|
|
|
import com.fr.plugin.chart.base.VanChartAttrMarker; |
|
|
|
|
import com.fr.plugin.chart.base.VanChartTools; |
|
|
|
|
import com.fr.plugin.chart.map.line.condition.AttrLineEffect; |
|
|
|
|
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; |
|
|
|
|
import com.fr.plugin.chart.vanchart.VanChart; |
|
|
|
|
import com.fr.van.chart.custom.component.VanChartHyperLinkPane; |
|
|
|
|
import com.fr.van.chart.designer.AbstractVanChartScrollPane; |
|
|
|
@ -22,7 +34,10 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
|
|
|
|
|
import com.fr.van.chart.designer.other.zoom.ZoomPane; |
|
|
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
|
public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> { |
|
|
|
|
|
|
|
|
@ -34,6 +49,10 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
protected UICheckBox fullScreenDisplay; |
|
|
|
|
protected UIToggleButton collapse; |
|
|
|
|
|
|
|
|
|
protected VanChart chart; |
|
|
|
|
private UIComboBox largeDataMode; |
|
|
|
|
private UISpinner largeModeThresholdNumber; |
|
|
|
|
|
|
|
|
|
protected UIButtonGroup isChartAnimation; |
|
|
|
|
|
|
|
|
|
//坐标轴翻转属性
|
|
|
|
@ -44,12 +63,12 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
private ZoomPane zoomPane; |
|
|
|
|
|
|
|
|
|
protected VanChartHyperLinkPane superLink; |
|
|
|
|
|
|
|
|
|
protected Chart chart; |
|
|
|
|
private JPanel largeModeThresholdNumberPane; |
|
|
|
|
protected JPanel interactivePane; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 界面标题. |
|
|
|
|
* |
|
|
|
|
* @return 返回标题. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
@ -81,6 +100,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{createToolBarPane(getToolBarRowSize(), columnSize), null}, |
|
|
|
|
new Component[]{createLargeDataModePane(), null}, |
|
|
|
|
new Component[]{createAnimationPane(), null}, |
|
|
|
|
new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null}, |
|
|
|
|
new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, |
|
|
|
@ -91,6 +111,43 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createLargeDataModePane() { |
|
|
|
|
if (!isCurrentChartSupportLargeDataMode()) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
largeDataMode = new UIComboBox(new LargeDataModeType[]{LargeDataModeType.CLOSE, LargeDataModeType.OPEN_BEYOND_THRESHOLD}); |
|
|
|
|
largeModeThresholdNumber = new UISpinner(0, Integer.MAX_VALUE, 100, chart.getPlot().getLargeDataAttribute().getLargeModeThresholdNumber()); |
|
|
|
|
|
|
|
|
|
largeDataMode.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
checkLargeDataMode(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
Component[][] comps1 = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Large_Model")), largeDataMode} |
|
|
|
|
}; |
|
|
|
|
Component[][] comps2 = new Component[][]{ |
|
|
|
|
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Threshold_Number")), largeModeThresholdNumber} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
double[] row = {TableLayout.PREFERRED}, col = {TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel contentPane = new JPanel(new BorderLayout(0, 6)); |
|
|
|
|
|
|
|
|
|
contentPane.add(TableLayout4VanChartHelper.createGapTableLayoutPane(comps1, row, col), BorderLayout.CENTER); |
|
|
|
|
largeModeThresholdNumberPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps2, row, col); |
|
|
|
|
contentPane.add(largeModeThresholdNumberPane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Large_Data"), contentPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected boolean isCurrentChartSupportLargeDataMode() { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected JPanel createZoomPane(double[] row, double[] col, VanChartPlot plot) { |
|
|
|
|
zoomPane = createZoomPane(); |
|
|
|
|
if (zoomPane == null) { |
|
|
|
@ -169,7 +226,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
|
|
|
|
|
protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) { |
|
|
|
|
boolean isLargeModel = largeModel(plot); |
|
|
|
|
return new AutoRefreshPane((VanChart) chart, isLargeModel); |
|
|
|
|
return new AutoRefreshPane(chart, isLargeModel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected JPanel createHyperlinkPane() { |
|
|
|
@ -177,13 +234,50 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Insert_Hyperlink"), superLink); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkLargeDataMode() { |
|
|
|
|
largeModeThresholdNumberPane.setVisible(largeDataMode.getSelectedItem() == LargeDataModeType.OPEN_BEYOND_THRESHOLD); |
|
|
|
|
|
|
|
|
|
resetAttr(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void resetAttr() { |
|
|
|
|
if (largeDataMode.getSelectedItem() == LargeDataModeType.OPEN_BEYOND_THRESHOLD) { |
|
|
|
|
VanChartPlot plot = this.chart.getPlot(); |
|
|
|
|
|
|
|
|
|
AttrLabel attrLabel = plot.getAttrLabelFromConditionCollection(); |
|
|
|
|
if (attrLabel == null) { |
|
|
|
|
attrLabel = plot.getDefaultAttrLabel(); |
|
|
|
|
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); |
|
|
|
|
defaultAttr.addDataSeriesCondition(attrLabel); |
|
|
|
|
} |
|
|
|
|
attrLabel.setEnable(false); |
|
|
|
|
|
|
|
|
|
resetCustomCondition(plot.getConditionCollection()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void resetCustomCondition(ConditionCollection conditionCollection) { |
|
|
|
|
for (int i = 0, len = conditionCollection.getConditionAttrSize(); i < len; i++) { |
|
|
|
|
ConditionAttr conditionAttr = conditionCollection.getConditionAttr(i); |
|
|
|
|
conditionAttr.remove(AttrLabel.class); |
|
|
|
|
conditionAttr.remove(ScatterAttrLabel.class); |
|
|
|
|
conditionAttr.remove(AttrEffect.class); |
|
|
|
|
conditionAttr.remove(AttrLineEffect.class); |
|
|
|
|
|
|
|
|
|
VanChartAttrMarker attrMarker = conditionAttr.getExisted(VanChartAttrMarker.class); |
|
|
|
|
if (attrMarker != null && !attrMarker.isCommon()) { |
|
|
|
|
conditionAttr.remove(VanChartAttrMarker.class); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(Chart chart) { |
|
|
|
|
if (chart == null || chart.getPlot() == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.chart = chart; |
|
|
|
|
this.chart = (VanChart) chart; |
|
|
|
|
VanChartPlot plot = chart.getPlot(); |
|
|
|
|
|
|
|
|
|
if (interactivePane == null) { |
|
|
|
@ -192,16 +286,17 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (zoomPane != null) { |
|
|
|
|
zoomPane.populateBean(((VanChart) chart).getZoomAttribute()); |
|
|
|
|
zoomPane.populateBean(this.chart.getZoomAttribute()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { |
|
|
|
|
populateChartAxisRotation(plot); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
populateChartTools((VanChart) chart); |
|
|
|
|
populateChartAnimate(chart, plot); |
|
|
|
|
populateAutoRefresh((VanChart)chart); |
|
|
|
|
populateChartTools(this.chart); |
|
|
|
|
populateLargeMode(plot); |
|
|
|
|
populateChartAnimate(this.chart, plot); |
|
|
|
|
populateAutoRefresh(this.chart); |
|
|
|
|
|
|
|
|
|
populateHyperlink(plot); |
|
|
|
|
} |
|
|
|
@ -219,6 +314,15 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
collapse.setSelected(vanChartTools.isHidden()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void populateLargeMode(Plot plot) { |
|
|
|
|
if (largeDataMode != null) { |
|
|
|
|
LargeDataAttribute attribute = plot.getLargeDataAttribute(); |
|
|
|
|
|
|
|
|
|
largeDataMode.setSelectedItem(attribute.getLargeDataModeType()); |
|
|
|
|
largeModeThresholdNumber.setValue(attribute.getLargeModeThresholdNumber()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void populateChartAxisRotation(VanChartPlot plot) { |
|
|
|
|
axisRotation.setSelectedIndex(plot.isAxisRotation() ? 0 : 1); |
|
|
|
|
} |
|
|
|
@ -235,7 +339,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void populateAutoRefresh(VanChart chart) { |
|
|
|
|
VanChartPlot plot = (VanChartPlot)chart.getPlot(); |
|
|
|
|
VanChartPlot plot = chart.getPlot(); |
|
|
|
|
|
|
|
|
|
RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); |
|
|
|
|
if (refreshMoreLabel == null) { |
|
|
|
@ -252,18 +356,20 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
VanChart vanChart = (VanChart) chart; |
|
|
|
|
VanChartPlot plot = chart.getPlot(); |
|
|
|
|
|
|
|
|
|
if (zoomPane != null) { |
|
|
|
|
((VanChart) chart).setZoomAttribute(zoomPane.updateBean()); |
|
|
|
|
vanChart.setZoomAttribute(zoomPane.updateBean()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (plot.getAxisPlotType() == AxisPlotType.RECTANGLE) { |
|
|
|
|
updateChartAxisRotation((VanChart)chart); |
|
|
|
|
updateChartAxisRotation(vanChart); |
|
|
|
|
} |
|
|
|
|
updateChartTools((VanChart)chart); |
|
|
|
|
updateChartAnimate(chart, plot); |
|
|
|
|
updateAutoRefresh((VanChart)chart); |
|
|
|
|
updateChartTools(vanChart); |
|
|
|
|
updateChartAnimate(vanChart, plot); |
|
|
|
|
updateLargeData(plot); |
|
|
|
|
updateAutoRefresh(vanChart); |
|
|
|
|
updateHyperlink(plot); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -282,7 +388,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
|
|
|
|
|
private void updateChartAxisRotation(VanChart chart) { |
|
|
|
|
//坐标轴和plot都需要这个属性,因为坐标轴和plot是分开画的
|
|
|
|
|
VanChartPlot plot = (VanChartPlot) chart.getPlot(); |
|
|
|
|
VanChartPlot plot = chart.getPlot(); |
|
|
|
|
plot.setAxisRotation(axisRotation.getSelectedIndex() == 0); |
|
|
|
|
//同时更新坐标轴旋转属性
|
|
|
|
|
for (VanChartAxis axis : ((VanChartRectanglePlot) plot).getXAxisList()) { |
|
|
|
@ -299,6 +405,15 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateLargeData(Plot plot) { |
|
|
|
|
if (largeDataMode != null) { |
|
|
|
|
LargeDataAttribute attribute = new LargeDataAttribute(); |
|
|
|
|
attribute.setLargeDataModeType((LargeDataModeType) largeDataMode.getSelectedItem()); |
|
|
|
|
attribute.setLargeModeThresholdNumber(largeModeThresholdNumber.getValue()); |
|
|
|
|
plot.setLargeDataAttribute(attribute); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateChartAnimate(Chart chart, Plot plot) { |
|
|
|
|
if (plot.isSupportAnimate()) { |
|
|
|
|
chart.setJSDraw(isChartAnimation.getSelectedIndex() == 0); |
|
|
|
@ -317,7 +432,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Chart updateBean() { |
|
|
|
|
public VanChart updateBean() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|