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