Browse Source

CHART-14228 向下兼容网格线

feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
4b95b5c5b9
  1. 58
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java

58
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java

@ -20,6 +20,7 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -48,10 +49,29 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private JPanel horizontalColorPane;
private JPanel verticalColorPane;
private Color horizontalColor;
private Color verticalColor;
public VanChartAxisAreaPane() {
initComponents();
}
public Color getHorizontalColor() {
return horizontalColor;
}
public void setHorizontalColor(Color horizontalColor) {
this.horizontalColor = horizontalColor;
}
public Color getVerticalColor() {
return verticalColor;
}
public void setVerticalColor(Color verticalColor) {
this.verticalColor = verticalColor;
}
private void initComponents() {
horizontalColorBox = new ColorSelectBox(PREFERRED_WIDTH);
verticalColorBox = new ColorSelectBox(PREFERRED_WIDTH);
@ -252,14 +272,44 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultXAxis = rectanglePlot.getDefaultXAxis();
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
// CHART-14241 10.0.6向下兼容10.0.5的设计器,分三种情况:
// 1、选中线型为无时,设置颜色为null
// 2、选中线型不为空,但是上次选中的线型为空时,使用上次保存下的color
// 3、选中前后均不为空时,正常set即可
if (defaultXAxis != null) {
defaultXAxis.setMainGridColor(verticalColorBox.getSelectObject());
defaultXAxis.setGridLineType((LineType) verticalLineType.getSelectedItem());
LineType selectVerticalType = (LineType) this.verticalLineType.getSelectedItem();
Color selectVerticalColor = verticalColorBox.getSelectObject();
setVerticalColor(selectVerticalColor);
if (selectVerticalType == LineType.NONE) {
defaultXAxis.setMainGridColor(null);
defaultXAxis.setGridLineType(LineType.NONE);
} else if (defaultXAxis.getGridLineType() == LineType.NONE) {
defaultXAxis.setMainGridColor(getVerticalColor());
defaultXAxis.setGridLineType(selectVerticalType);
} else {
defaultXAxis.setMainGridColor(selectVerticalColor);
defaultXAxis.setGridLineType(selectVerticalType);
}
}
if (defaultYAxis != null) {
defaultYAxis.setMainGridColor(horizontalColorBox.getSelectObject());
defaultYAxis.setGridLineType((LineType) horizonLineType.getSelectedItem());
LineType selectHorizontalType = (LineType) this.horizonLineType.getSelectedItem();
Color selectHorizontalColor = horizontalColorBox.getSelectObject();
setHorizontalColor(selectHorizontalColor);
if (selectHorizontalType == LineType.NONE) {
defaultYAxis.setMainGridColor(null);
defaultYAxis.setGridLineType(LineType.NONE);
} else if (defaultYAxis.getGridLineType() == LineType.NONE) {
defaultYAxis.setMainGridColor(getHorizontalColor());
defaultYAxis.setGridLineType(selectHorizontalType);
} else {
defaultYAxis.setMainGridColor(selectHorizontalColor);
defaultYAxis.setGridLineType(selectHorizontalType);
}
}
}

Loading…
Cancel
Save