|
|
@ -7,8 +7,6 @@ import com.fr.base.chart.chartdata.TopDefinitionProvider; |
|
|
|
import com.fr.chart.base.TextAttr; |
|
|
|
import com.fr.chart.base.TextAttr; |
|
|
|
import com.fr.chart.chartattr.Chart; |
|
|
|
import com.fr.chart.chartattr.Chart; |
|
|
|
import com.fr.chart.chartattr.Title; |
|
|
|
import com.fr.chart.chartattr.Title; |
|
|
|
import com.fr.chart.chartdata.NormalReportDataDefinition; |
|
|
|
|
|
|
|
import com.fr.chart.chartdata.NormalTableDataDefinition; |
|
|
|
|
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
import com.fr.design.beans.FurtherBasicBeanPane; |
|
|
|
import com.fr.design.formula.TinyFormulaPane; |
|
|
|
import com.fr.design.formula.TinyFormulaPane; |
|
|
|
import com.fr.design.gui.frpane.UINumberDragPane; |
|
|
|
import com.fr.design.gui.frpane.UINumberDragPane; |
|
|
@ -51,9 +49,7 @@ import java.awt.Component; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 坐标轴的基础配置项。分类,时间,值等公共的部分。 |
|
|
|
* 坐标轴的基础配置项。分类,时间,值等公共的部分。 |
|
|
@ -616,73 +612,44 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
} |
|
|
|
} |
|
|
|
categoryStylePane.removeAll(); |
|
|
|
categoryStylePane.removeAll(); |
|
|
|
categoryStyles.clear(); |
|
|
|
categoryStyles.clear(); |
|
|
|
populateDefaultCateLabelStyle(axis); |
|
|
|
populateCateLabelStyle(axis); |
|
|
|
populateMoreCateLabelStyle(axis); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
categoryStylePane.revalidate(); |
|
|
|
categoryStylePane.revalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 默认一定会有一个分类标签,就populate这个 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void populateDefaultCateLabelStyle(VanChartAxis axis) { |
|
|
|
|
|
|
|
populateCategoryStyles(axis, VanChartAxis.DEFAULT_CATEGORY_UUID, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* populate其余的分类标签 |
|
|
|
* populate分类标签 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param axis |
|
|
|
* @param axis |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void populateMoreCateLabelStyle(VanChartAxis axis) { |
|
|
|
private void populateCateLabelStyle(VanChartAxis axis) { |
|
|
|
Chart chart = axis.getChart(); |
|
|
|
Chart chart = axis.getChart(); |
|
|
|
Map<String, String> moreCateLabels = new LinkedHashMap<>(); |
|
|
|
int size; |
|
|
|
TopDefinitionProvider definition = chart.getFilterDefinition(); |
|
|
|
TopDefinitionProvider definition = chart.getFilterDefinition(); |
|
|
|
if (definition == null) { |
|
|
|
size = definition == null ? 1 : definition.getMoreCateSize() + 1; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (definition instanceof NormalTableDataDefinition) { |
|
|
|
|
|
|
|
NormalTableDataDefinition tableDataDefinition = (NormalTableDataDefinition) definition; |
|
|
|
|
|
|
|
moreCateLabels.putAll(tableDataDefinition.getMoreCateLabels()); |
|
|
|
|
|
|
|
} else if (definition instanceof NormalReportDataDefinition) { |
|
|
|
|
|
|
|
NormalReportDataDefinition reportDataDefinition = (NormalReportDataDefinition) definition; |
|
|
|
|
|
|
|
for (Map.Entry<String, Object> entry : reportDataDefinition.getMoreCateLabels().entrySet()) { |
|
|
|
|
|
|
|
String uuid = entry.getKey(); |
|
|
|
|
|
|
|
String cateLabel = Utils.objectToString(entry.getValue()); |
|
|
|
|
|
|
|
moreCateLabels.put(uuid, cateLabel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int i = 1; |
|
|
|
for (int i = 0; i < size; i++) { |
|
|
|
List<String> uuids = new ArrayList<>(); |
|
|
|
populateCategoryStyles(axis, i); |
|
|
|
for (Map.Entry<String, String> entry : moreCateLabels.entrySet()) { |
|
|
|
|
|
|
|
String uuid = entry.getKey(); |
|
|
|
|
|
|
|
uuids.add(uuid); |
|
|
|
|
|
|
|
populateCategoryStyles(axis, uuid, i); |
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
axis.retainUsefulCategoryStyles(uuids); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void populateCategoryStyles(VanChartAxis axis, String uuid, int index) { |
|
|
|
private void populateCategoryStyles(VanChartAxis axis, int index) { |
|
|
|
VanChartCategoryStylePaneWithCheckBox pane = new VanChartCategoryStylePaneWithCheckBox(parent, this, Toolkit.i18nText("Fine-Design_Chart_Style_Category") + (index + 1)); |
|
|
|
VanChartCategoryStylePaneWithCheckBox pane = new VanChartCategoryStylePaneWithCheckBox(parent, this, Toolkit.i18nText("Fine-Design_Chart_Style_Category") + (index + 1)); |
|
|
|
VanChartAxisLabelStyle style = populateAxisCategoryStyles(axis, uuid, index); |
|
|
|
VanChartAxisLabelStyle style = populateAxisCategoryStyles(axis, index); |
|
|
|
pane.populate(style, uuid); |
|
|
|
pane.populate(style); |
|
|
|
categoryStyles.add(pane); |
|
|
|
categoryStyles.add(pane); |
|
|
|
categoryStylePane.add(createCateLableStylePanel(), BorderLayout.NORTH); |
|
|
|
categoryStylePane.add(createCateLableStylePanel(), BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private VanChartAxisLabelStyle populateAxisCategoryStyles(VanChartAxis axis, String uuid, int index) { |
|
|
|
private VanChartAxisLabelStyle populateAxisCategoryStyles(VanChartAxis axis, int index) { |
|
|
|
VanChartAxisLabelStyle style; |
|
|
|
VanChartAxisLabelStyle style; |
|
|
|
if (axis.getCategoryStyle(uuid) != null) { |
|
|
|
if (axis.getCategoryStylesSize() > index && axis.getCategoryStyle(index) != null) { |
|
|
|
style = axis.getCategoryStyle(uuid); |
|
|
|
style = axis.getCategoryStyle(index); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
style = axis.getCategoryStyleByIndex(index); |
|
|
|
|
|
|
|
if (style == null) { |
|
|
|
|
|
|
|
style = new VanChartAxisLabelStyle(); |
|
|
|
style = new VanChartAxisLabelStyle(); |
|
|
|
} |
|
|
|
axis.addCategoryStyle(style); |
|
|
|
axis.addCategoryStyle(uuid, style); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return style; |
|
|
|
return style; |
|
|
|
} |
|
|
|
} |
|
|
@ -875,12 +842,11 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
* @param axis |
|
|
|
* @param axis |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateLayerDisplayPane(VanChartAxis axis) { |
|
|
|
private void updateLayerDisplayPane(VanChartAxis axis) { |
|
|
|
|
|
|
|
List<VanChartAxisLabelStyle> styles = new ArrayList<>(); |
|
|
|
for (VanChartCategoryStylePaneWithCheckBox categoryStyle : categoryStyles) { |
|
|
|
for (VanChartCategoryStylePaneWithCheckBox categoryStyle : categoryStyles) { |
|
|
|
Map<String, VanChartAxisLabelStyle> styleMap = categoryStyle.update(); |
|
|
|
styles.add(categoryStyle.update()); |
|
|
|
for (Map.Entry<String, VanChartAxisLabelStyle> entry : styleMap.entrySet()) { |
|
|
|
|
|
|
|
axis.addCategoryStyle(entry.getKey(), entry.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
axis.setCategoryStyles(styles); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//轴线样式
|
|
|
|
//轴线样式
|
|
|
|