Browse Source

Pull request #1642: CHART-13740 雷达图网格线支持线型选择

Merge in DESIGN/design from ~QINGHUI.LIU/design:release/10.0 to release/10.0

* commit '6b1f8a513df8e915c60ccb6f9eb4ddad01bd916e':
  修改变量名
  CHART-13740 雷达图网格线支持线型选择
feature/big-screen
Qinghui.Liu 5 years ago
parent
commit
29c923bbd1
  1. 63
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java
  2. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAxisAreaPane.java

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

@ -32,9 +32,6 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private static final int PREFERRED_WIDTH = 100;
protected ColorSelectBox horizontalGridLine;
protected ColorSelectBox verticalGridLine;
protected AlertLineListControlPane alertLine;
private UIButtonGroup isDefaultIntervalBackground;
@ -44,8 +41,10 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private ColorSelectBox verticalColorBackground;
protected BackgroundListControlPane customIntervalBackground;
private LineTypeComboBox horizonLineType;//横向线型
private LineTypeComboBox verticalLineType;//纵向线型
private LineTypeComboBox horizonLineType;
private LineTypeComboBox verticalLineType;
private ColorSelectBox horizontalColorBox;
private ColorSelectBox verticalColorBox;
private JPanel horizontalColorPane;
private JPanel verticalColorPane;
@ -53,9 +52,9 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
initComponents();
}
protected void initComponents() {
horizontalGridLine = new ColorSelectBox(PREFERRED_WIDTH);
verticalGridLine = new ColorSelectBox(PREFERRED_WIDTH);
private void initComponents() {
horizontalColorBox = new ColorSelectBox(PREFERRED_WIDTH);
verticalColorBox = new ColorSelectBox(PREFERRED_WIDTH);
horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED});
verticalLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED});
@ -77,23 +76,33 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
}
protected JPanel createGridLinePane() {
initGridLineComponents();
JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(createSingleGridLinePane(Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), true), BorderLayout.NORTH);
panel.add(createSingleGridLinePane(Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), false), BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
}
protected void initGridLineComponents() {
Component[][] upComponent = new Component[][]{
new Component[]{null, null},
new Component[]{null, horizontalGridLine}
new Component[]{null, horizontalColorBox}
};
horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent);
Component[][] downComponent = new Component[][]{
new Component[]{null, null},
new Component[]{null, verticalGridLine}
new Component[]{null, verticalColorBox}
};
verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent);
horizonLineType.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (horizontalGridLine == null || horizonLineType == null) {
if (horizontalColorBox == null || horizonLineType == null) {
return;
}
horizontalColorPane.setVisible(horizonLineType.getSelectedItem() != LineType.NONE);
@ -103,7 +112,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
verticalLineType.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (verticalGridLine == null || verticalLineType == null) {
if (verticalColorBox == null || verticalLineType == null) {
return;
}
verticalColorPane.setVisible(verticalLineType.getSelectedItem() != LineType.NONE);
@ -111,22 +120,20 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
});
checkColorBoxVisible();
}
JPanel horizonLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), horizonLineType);
JPanel horizontal = new JPanel(new BorderLayout());
horizontal.add(horizonLineTypePane, BorderLayout.NORTH);
horizontal.add(horizontalColorPane, BorderLayout.CENTER);
protected JPanel createSingleGridLinePane(String title, boolean isHorizontal) {
LineTypeComboBox lineTypeComboBox = isHorizontal ? horizonLineType : verticalLineType;
JPanel colorSelectPane = isHorizontal ? horizontalColorPane : verticalColorPane;
JPanel verticalLineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), verticalLineType);
JPanel vertical = new JPanel(new BorderLayout());
vertical.add(verticalLineTypePane, BorderLayout.NORTH);
vertical.add(verticalColorPane, BorderLayout.CENTER);
JPanel lineTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(title, lineTypeComboBox);
JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(horizontal, BorderLayout.NORTH);
panel.add(vertical, BorderLayout.CENTER);
JPanel singleGridLinePane = new JPanel(new BorderLayout());
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
singleGridLinePane.add(lineTypePane, BorderLayout.NORTH);
singleGridLinePane.add(colorSelectPane, BorderLayout.CENTER);
return singleGridLinePane;
}
protected JPanel createAlertLinePane() {
@ -213,12 +220,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
if (defaultXAxis != null) {
verticalGridLine.setSelectObject(defaultXAxis.getMainGridColor());
verticalColorBox.setSelectObject(defaultXAxis.getMainGridColor());
verticalLineType.setSelectedItem(defaultXAxis.getGridLineType());
}
if (defaultYAxis != null) {
horizontalGridLine.setSelectObject(defaultYAxis.getMainGridColor());
horizontalColorBox.setSelectObject(defaultYAxis.getMainGridColor());
horizonLineType.setSelectedItem(defaultYAxis.getGridLineType());
}
}
@ -246,12 +253,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
if (defaultXAxis != null) {
defaultXAxis.setMainGridColor(verticalGridLine.getSelectObject());
defaultXAxis.setMainGridColor(verticalColorBox.getSelectObject());
defaultXAxis.setGridLineType((LineType) verticalLineType.getSelectedItem());
}
if (defaultYAxis != null) {
defaultYAxis.setMainGridColor(horizontalGridLine.getSelectObject());
defaultYAxis.setMainGridColor(horizontalColorBox.getSelectObject());
defaultYAxis.setGridLineType((LineType) horizonLineType.getSelectedItem());
}
}

21
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAxisAreaPane.java

@ -3,15 +3,14 @@ package com.fr.van.chart.designer.style.background.radar;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.background.AlertLineListControlPane;
import com.fr.van.chart.designer.style.background.BackgroundListControlPane;
import com.fr.van.chart.designer.style.background.VanChartAxisAreaPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Arrays;
/**
* 样式-背景-绘图区背景-雷达图只有Y轴的配置间隔背景网格线警戒线
@ -23,24 +22,18 @@ public class VanChartRadarAxisAreaPane extends VanChartAxisAreaPane {
//雷达图只有横向的y轴的网格线配置
@Override
protected JPanel createGridLinePane() {
initGridLineComponents();
JPanel panel = new JPanel(new BorderLayout(0, 4));
panel.add(createSingleGridLinePane(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), true), BorderLayout.CENTER);
Component[][] components = new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),horizontalGridLine},
};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] row = new double[components.length];
Arrays.fill(row, p);
double[] col = {f, e};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Grid_Line"), panel);
}
protected Component[][] getIntervalPaneComponents() {
return new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),horizontalColorBackground},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), horizontalColorBackground},
};
}

Loading…
Cancel
Save