You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
2.9 KiB
96 lines
2.9 KiB
package com.fr.plugin.chart.bar; |
|
|
|
import com.fr.chart.chartattr.Chart; |
|
import com.fr.chart.chartattr.Plot; |
|
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
|
import com.fr.general.FRLogger; |
|
import com.fr.general.Inter; |
|
import com.fr.plugin.chart.column.VanChartColumnPlot; |
|
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
|
|
|
/** |
|
* Created by Mitisky on 15/10/20. |
|
*/ |
|
public class VanChartBarPlotPane extends AbstractVanChartTypePane { |
|
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBar"); |
|
|
|
private static final long serialVersionUID = 2879689884048643002L; |
|
|
|
@Override |
|
protected String[] getTypeIconPath() { |
|
return new String[]{"/com/fr/plugin/chart/bar/images/bar.png", |
|
"/com/fr/plugin/chart/bar/images/stack.png", |
|
"/com/fr/plugin/chart/bar/images/percentstack.png", |
|
"/com/fr/plugin/chart/bar/images/custom.png", |
|
}; |
|
} |
|
|
|
@Override |
|
protected String[] getTypeTipName() { |
|
String bar = Inter.getLocText("FR-Chart-Type_Bar"); |
|
String stack = Inter.getLocText("FR-Chart-Type_Stacked"); |
|
String percent = Inter.getLocText("FR-Chart-Use_Percent"); |
|
return new String[]{ |
|
bar, |
|
stack + bar, |
|
percent + stack + bar, |
|
Inter.getLocText("FR-Chart-Mode_Custom") |
|
}; |
|
} |
|
|
|
/** |
|
* 返回界面标题 |
|
* @return 界面标题 |
|
*/ |
|
public String title4PopupWindow() { |
|
return Inter.getLocText("Plugin-ChartF_NewBar"); |
|
} |
|
|
|
/** |
|
* 更新界面内容 |
|
*/ |
|
public void populateBean(Chart chart) { |
|
for(ChartImagePane imagePane : typeDemo) { |
|
imagePane.isPressing = false; |
|
} |
|
Plot plot = chart.getPlot(); |
|
if(plot instanceof VanChartColumnPlot) { |
|
lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal(); |
|
typeDemo.get(lastTypeIndex).isPressing = true; |
|
} |
|
checkDemosBackground(); |
|
} |
|
|
|
/** |
|
* 获取各图表类型界面ID, 本质是plotID |
|
* |
|
* @return 图表类型界面ID |
|
*/ |
|
@Override |
|
protected String getPlotTypeID() { |
|
return VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID; |
|
} |
|
|
|
protected Plot getSelectedClonedPlot(){ |
|
VanChartColumnPlot newPlot = null; |
|
Chart[] barChart = BarIndependentVanChart.BarVanChartTypes; |
|
for(int i = 0, len = barChart.length; i < len; i++){ |
|
if(typeDemo.get(i).isPressing){ |
|
newPlot = (VanChartColumnPlot)barChart[i].getPlot(); |
|
} |
|
} |
|
|
|
Plot cloned = null; |
|
try { |
|
cloned = (Plot)newPlot.clone(); |
|
} catch (CloneNotSupportedException e) { |
|
FRLogger.getLogger().error("Error In ColumnChart"); |
|
} |
|
return cloned; |
|
} |
|
|
|
public Chart getDefaultChart() { |
|
return BarIndependentVanChart.BarVanChartTypes[0]; |
|
} |
|
|
|
} |