Revision 2568

tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 2568)
70 70
	 * @param parametersNodePath
71 71
	 */
72 72
	public PartitionDimensions(String parametersNodePath) {
73
		super(parametersNodePath, null);
73
		this(parametersNodePath, null);
74 74
	}
75 75
	
76 76
	/**
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsBarChartCreator.java (revision 2568)
24 24

  
25 25
/**
26 26
 * Creates a partition dimensions bar chart from the specified <code>PartitionDimensions</code> result.
27
 * 
27 28
 * @author sjacquot
28 29
 *
29 30
 */
30 31
public class JFCPartitionDimensionsBarChartCreator extends JFCChartCreator {
31

  
32

  
32
	
33
	
33 34
	@Override
34 35
	public JFreeChart createChart(ChartResult result) {
35

  
36
		
36 37
		JFreeChart chart = null;
37

  
38
		
38 39
		// Creating an empty data set
39 40
		XYSeriesCollection dataset = new XYSeriesCollection();
40

  
41
		
41 42
		// Create the chart
42
        chart = this.getChartsEngine().createXYBarChart(dataset, null, PartitionCoreMessages.part, PartitionCoreMessages.numberOfWords, false, true);
43
        // Custom range axis for ticks drawing options
44
        chart.getXYPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getXYPlot().getRangeAxis(), false, true, 0, DatasetUtils.findMaximumRangeValue(chart.getXYPlot().getDataset()).doubleValue()));
45

  
43
		chart = this.getChartsEngine().createXYBarChart(dataset, null, PartitionCoreMessages.part, PartitionCoreMessages.numberOfWords, false, true);
44
		// Custom range axis for ticks drawing options
45
		chart.getXYPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getXYPlot().getRangeAxis(), false, true, 0, DatasetUtils.findMaximumRangeValue(chart.getXYPlot().getDataset())
46
				.doubleValue()));
47
		
46 48
		return chart;
47 49
		
48 50
	}
49

  
51
	
50 52
	@Override
51 53
	public void updateChart(ChartResult result) {
52 54
		
......
62 64
		boolean displayPartsCountInTitle = partitionDimensions.isDisplayingPartCountInTitle();
63 65
		
64 66
		
65
		if(result.hasParameterChanged(ChartsEnginePreferences.CHART_TYPE)
66
				|| result.hasParameterChanged(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE))	{
67
		if (result.hasParameterChanged(ChartsEnginePreferences.CHART_TYPE)
68
				|| result.hasParameterChanged(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE)) {
67 69
			
68 70
			// Fill the data set from the result
69 71
			XYSeriesCollection dataset = (XYSeriesCollection) chart.getXYPlot().getDataset();
......
71 73
			
72 74
			XYSeries series = new XYSeries(PartitionCoreMessages.t);
73 75
			dataset.addSeries(series);
74
	
76
			
75 77
			List<Part> parts = partitionDimensions.getParts(sortPartsBySize);
76
	        String[] xAxisSymbols = new String[parts.size()];
77
	
78
	
78
			String[] xAxisSymbols = new String[parts.size()];
79
			
80
			
79 81
			try {
80
				for (int i = 0 ; i < parts.size() ; i++) {
82
				for (int i = 0; i < parts.size(); i++) {
81 83
					series.add(i, parts.get(i).getSize());
82
	
84
					
83 85
					// Add X axis symbol
84 86
					xAxisSymbols[i] = parts.get(i).getName();
85 87
				}
86 88
			}
87
			catch(CqiClientException e) {
89
			catch (CqiClientException e) {
88 90
				// TODO Auto-generated catch block
89 91
				e.printStackTrace();
90 92
			}
91
	
93
			
92 94
			chart.getXYPlot().setDomainAxis(new SymbolAxisBetweenTicks(chart.getXYPlot().getDomainAxis().getLabel(), xAxisSymbols));
93 95
		}
94 96
		
......
97 99
		chart.setTitle(Utils.createPartitionDimensionsChartTitle(partitionDimensions));
98 100
		
99 101
		// Subtitle
100
		if(chart.getSubtitleCount() > 0)	{
101
			chart.removeSubtitle(chart.getSubtitle(0));	
102
		if (chart.getSubtitleCount() > 0) {
103
			chart.removeSubtitle(chart.getSubtitle(0));
102 104
		}
103
		chart.addSubtitle(new TextTitle(Utils.createPartitionDimensionsChartSubtitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle), this.getChartsEngine().getJFCTheme().getSmallFont(),
104
				((Color)this.getChartsEngine().getJFCTheme().getAxisLabelPaint()), Title.DEFAULT_POSITION,
105
                Title.DEFAULT_HORIZONTAL_ALIGNMENT,
106
                Title.DEFAULT_VERTICAL_ALIGNMENT, Title.DEFAULT_PADDING));
105
		chart.addSubtitle(new TextTitle(Utils.createPartitionDimensionsChartSubtitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle), this.getChartsEngine().getJFCTheme()
106
				.getSmallFont(),
107
				(this.getChartsEngine().getJFCTheme().getAxisLabelPaint()), Title.DEFAULT_POSITION,
108
				Title.DEFAULT_HORIZONTAL_ALIGNMENT,
109
				Title.DEFAULT_VERTICAL_ALIGNMENT, Title.DEFAULT_PADDING));
107 110
		
108 111
		
109 112
		super.updateChart(result);
110

  
111 113
		
112

  
114
		
115
		
113 116
	}
114 117
	
115

  
118
	
116 119
	@Override
117 120
	public Class getResultDataClass() {
118 121
		return PartitionDimensions.class;
119 122
	}
120 123
	
121

  
122 124
	
123 125
	
124

  
125
}
126
	
127
	
128
}
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartCreator.java (revision 2568)
112 112
	
113 113
	@Override
114 114
	public ArrayList<Color> getSeriesShapesColors(Object chart) {
115
		ArrayList<Color> colors = new ArrayList<Color>();
115
		ArrayList<Color> colors = new ArrayList<>();
116 116
		JFreeChart c = (JFreeChart) chart;
117 117
		
118 118
		// XY plot

Also available in: Unified diff