Révision 3352
TXM/trunk/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java (revision 3352) | ||
---|---|---|
36 | 36 |
*/ |
37 | 37 |
public class TextsBalance extends ChartResult { |
38 | 38 |
|
39 |
HashMap<Integer, Comparable[]> dataset;
|
|
39 |
HashMap<Comparable[], Integer> dataset;
|
|
40 | 40 |
|
41 | 41 |
protected String propertyName; |
42 | 42 |
protected List<String> values; |
... | ... | |
130 | 130 |
|
131 | 131 |
monitor.setTask("Computing balance with metadata propertyName = " + this.structuralUnitProperty + ", structural unit = " + this.structuralUnit.getName() + " and groupByTexts = " + this.countTexts); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
132 | 132 |
try { |
133 |
this.dataset = new HashMap<Integer, Comparable[]>();
|
|
133 |
this.dataset = new HashMap<Comparable[], Integer>();
|
|
134 | 134 |
|
135 | 135 |
StructuralUnitProperty p = this.structuralUnitProperty; |
136 | 136 |
this.values = p.getValues(); |
137 | 137 |
Collections.sort(this.values); |
138 | 138 |
|
139 |
this.fMax = 0; |
|
140 |
this.fMin = Integer.MAX_VALUE; |
|
141 |
|
|
139 | 142 |
// using CQL to solve matches |
140 | 143 |
if (this.method == 1) { |
141 | 144 |
for (String value : this.values) { |
... | ... | |
160 | 163 |
if (v > this.fMax) { |
161 | 164 |
this.fMax = v; |
162 | 165 |
} |
163 |
this.dataset.put(v, new Comparable[]{p.getName(), value});
|
|
166 |
this.dataset.put(new Comparable[]{p.getName(), value}, v);
|
|
164 | 167 |
} |
165 | 168 |
} |
166 | 169 |
else { |
... | ... | |
220 | 223 |
if (v > this.fMax) { |
221 | 224 |
this.fMax = v; |
222 | 225 |
} |
223 |
this.dataset.put(v, new Comparable[]{p.getName(), k.toString()});
|
|
226 |
this.dataset.put(new String[]{p.getName(), k.toString()}, v);
|
|
224 | 227 |
} |
225 | 228 |
} |
226 | 229 |
} |
... | ... | |
266 | 269 |
/** |
267 | 270 |
* @return the dataset |
268 | 271 |
*/ |
269 |
public HashMap<Integer, Comparable[]> getDataset() {
|
|
272 |
public HashMap<Comparable[], Integer> getDataset() {
|
|
270 | 273 |
return dataset; |
271 | 274 |
} |
272 | 275 |
|
TXM/trunk/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/jfreechart/JFCTextsBalanceSpiderChartCreator.java (revision 3352) | ||
---|---|---|
16 | 16 |
public class JFCTextsBalanceSpiderChartCreator extends JFCChartCreator { |
17 | 17 |
|
18 | 18 |
|
19 |
private SpiderWebPlot plot; |
|
20 |
|
|
19 | 21 |
@Override |
20 | 22 |
public JFreeChart createChart(ChartResult result) { |
21 | 23 |
|
... | ... | |
23 | 25 |
JFreeChart chart = null; |
24 | 26 |
|
25 | 27 |
// Creates an empty dataset |
26 |
HashMap<Integer, Comparable[]> data = textsBalance.getDataset();
|
|
28 |
HashMap<Comparable[], Integer> data = textsBalance.getDataset();
|
|
27 | 29 |
DefaultCategoryDataset dataset = new DefaultCategoryDataset(); |
28 | 30 |
|
29 |
SpiderWebPlot plot = new SpiderWebPlot(dataset);
|
|
31 |
plot = new SpiderWebPlot(dataset); |
|
30 | 32 |
plot.setToolTipGenerator(new CategoryToolTipGenerator() { |
31 | 33 |
|
32 | 34 |
@Override |
... | ... | |
61 | 63 |
chart.setNotify(false); |
62 | 64 |
|
63 | 65 |
// updating data set |
64 |
HashMap<Integer, Comparable[]> data = textsBalance.getDataset();
|
|
66 |
HashMap<Comparable[], Integer> data = textsBalance.getDataset();
|
|
65 | 67 |
DefaultCategoryDataset dataset = (DefaultCategoryDataset) ((SpiderWebPlot) chart.getPlot()).getDataset(); |
66 | 68 |
dataset.clear(); |
67 | 69 |
|
68 |
Set<Integer> keys = data.keySet();
|
|
69 |
Iterator<Integer> it = keys.iterator();
|
|
70 |
Set<Comparable[]> keys = data.keySet();
|
|
71 |
Iterator<Comparable[]> it = keys.iterator();
|
|
70 | 72 |
while (it.hasNext()) { |
71 |
int key = it.next();
|
|
72 |
Comparable[] value = data.get(key);
|
|
73 |
System.out.println("JFCTextsBalanceSpiderChartCreator.updateChart(): adding " + key + ", " + value[0] + ", " + value[1] + " to dataset."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
74 |
dataset.addValue(key, value[0], value[1]);
|
|
73 |
Comparable[] key = it.next();
|
|
74 |
Integer value = data.get(key);
|
|
75 |
System.out.println("JFCTextsBalanceSpiderChartCreator.updateChart(): adding " + key + ", " + key[0] + ", " + key[1] + " to dataset."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
76 |
dataset.addValue(value, key[0], key[1]);
|
|
75 | 77 |
} |
76 | 78 |
|
77 |
chart.setTitle("metadata = " + textsBalance.getStructuralUnitProperty() + ", N = " + textsBalance.getValues().size() + ", fmin = " + textsBalance.getFMin() + ", fmax = " + textsBalance
|
|
78 |
.getFMax() + ", group by texts = " + textsBalance.groupingByTexts()); |
|
79 |
chart.setTitle("metadata = " + textsBalance.getStructuralUnitProperty() + ", N = " + textsBalance.getValues().size() + ", fmin = " + textsBalance.getFMin() + |
|
80 |
", fmax = " + textsBalance.getFMax() + ", group by texts = " + textsBalance.groupingByTexts());
|
|
79 | 81 |
|
82 |
plot.setMaxValue(textsBalance.getFMax()); |
|
83 |
|
|
80 | 84 |
super.updateChart(result); |
81 | 85 |
} |
82 | 86 |
|
TXM/trunk/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/editors/TextsBalanceEditor.java (revision 3352) | ||
---|---|---|
79 | 79 |
|
80 | 80 |
|
81 | 81 |
// Structural units and properties combo viewers |
82 |
StructuralUnitsCombosGroup structuration = new StructuralUnitsCombosGroup(parametersArea, this, this.getResult().getStructuralUnit(), this.getResult().getStructuralUnitProperty(), false);
|
|
82 |
StructuralUnitsCombosGroup structuration = new StructuralUnitsCombosGroup(this.getMainParametersComposite(), this, this.getResult().getStructuralUnit(), this.getResult().getStructuralUnitProperty(), false);
|
|
83 | 83 |
|
84 | 84 |
// Structural Unit |
85 | 85 |
structuralUnitsComboViewer = structuration.getStructuralUnitsComboViewer(); |
Formats disponibles : Unified diff