Révision 1745
| tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/base/Utils.java (revision 1745) | ||
|---|---|---|
| 4 | 4 |
import org.txm.partition.core.messages.PartitionCoreMessages; |
| 5 | 5 |
|
| 6 | 6 |
/** |
| 7 |
* Creates a partition dimensions bar chart from the specified <code>Partition</code> result. |
|
| 7 |
* Utility class for partition dimensions bar chart. |
|
| 8 |
* |
|
| 8 | 9 |
* @author sjacquot |
| 9 | 10 |
* |
| 10 | 11 |
*/ |
| 11 | 12 |
public abstract class Utils {
|
| 12 | 13 |
|
| 13 |
public Utils() {
|
|
| 14 |
// TODO Auto-generated constructor stub |
|
| 15 |
} |
|
| 16 | 14 |
|
| 17 |
|
|
| 18 | 15 |
/** |
| 19 |
* Creates a string title, shared by charts engine implementations, for the dimensions partition chart from the specified result.
|
|
| 16 |
* Creates a string title, shared by charts engine implementations, for the partition dimensions chart from the specified result.
|
|
| 20 | 17 |
* @param the partition result |
| 21 | 18 |
* @param sortPartsBySize the sort parts by size state |
| 22 | 19 |
* @param displayPartsCountInTitle display or not the parts count in chart title |
| ... | ... | |
| 26 | 23 |
return PartitionCoreMessages.bind(PartitionCoreMessages.dimensionsOfTheP0PartitionInTheP1Corpus, partitionDimensions.getParent().getSimpleName(), partitionDimensions.getCorpus().getSimpleName()); |
| 27 | 24 |
} |
| 28 | 25 |
|
| 29 |
|
|
| 26 |
/** |
|
| 27 |
* Creates a string subtitle, shared by charts engine implementations, for the partition dimensions chart from the specified result. |
|
| 28 |
* @param partitionDimensions the partition result |
|
| 29 |
* @param sortPartsBySize the sort parts by size state |
|
| 30 |
* @param displayPartsCountInTitle displayPartsCountInTitle display or not the parts count in chart title |
|
| 31 |
* @return the subtitle string |
|
| 32 |
*/ |
|
| 30 | 33 |
public static String createPartitionDimensionsChartSubtitle(PartitionDimensions partitionDimensions, boolean sortPartsBySize, boolean displayPartsCountInTitle) {
|
| 31 | 34 |
|
| 32 |
String title = "";
|
|
| 35 |
String subtitle = ""; //$NON-NLS-1$
|
|
| 33 | 36 |
|
| 34 | 37 |
if(displayPartsCountInTitle) {
|
| 35 |
title += partitionDimensions.getPartsCount() + " " + PartitionCoreMessages.parts; //$NON-NLS-1$ |
|
| 38 |
subtitle += partitionDimensions.getPartsCount() + " " + PartitionCoreMessages.parts; //$NON-NLS-1$
|
|
| 36 | 39 |
} |
| 37 | 40 |
|
| 38 | 41 |
if(displayPartsCountInTitle && sortPartsBySize) {
|
| 39 |
title += " ";
|
|
| 42 |
subtitle += " "; //$NON-NLS-1$
|
|
| 40 | 43 |
} |
| 41 | 44 |
|
| 42 | 45 |
if(sortPartsBySize) {
|
| 43 |
title += PartitionCoreMessages.sortedBySize; |
|
| 46 |
subtitle += PartitionCoreMessages.sortedBySize;
|
|
| 44 | 47 |
} |
| 45 | 48 |
|
| 46 |
return title; |
|
| 49 |
return subtitle;
|
|
| 47 | 50 |
|
| 48 | 51 |
} |
| 49 | 52 |
} |
| tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java (revision 1745) | ||
|---|---|---|
| 3 | 3 |
import java.io.File; |
| 4 | 4 |
import java.util.List; |
| 5 | 5 |
|
| 6 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
|
| 7 | 6 |
import org.txm.chartsengine.core.results.ChartResult; |
| 8 | 7 |
import org.txm.chartsengine.r.core.RChartCreator; |
| 9 | 8 |
import org.txm.chartsengine.r.core.RChartsEngine; |
| ... | ... | |
| 15 | 14 |
|
| 16 | 15 |
/** |
| 17 | 16 |
* Creates a partition dimensions bar chart from the specified <code>PartitionDimensions</code> result. |
| 17 |
* |
|
| 18 | 18 |
* @author sjacquot |
| 19 | 19 |
* |
| 20 | 20 |
*/ |
| ... | ... | |
| 50 | 50 |
String ssizes = "c("; //$NON-NLS-1$
|
| 51 | 51 |
|
| 52 | 52 |
for(int i = 0; i < parts.size(); i++) {
|
| 53 |
ssizes += "" + parts.get(i).getSize(); //$NON-NLS-1$
|
|
| 53 |
ssizes += parts.get(i).getSize();
|
|
| 54 | 54 |
if(i != parts.size() - 1) |
| 55 | 55 |
ssizes += ","; //$NON-NLS-1$ |
| 56 | 56 |
} |
| ... | ... | |
| 67 | 67 |
// FIXME: one color by part |
| 68 | 68 |
//this.getChartsEngine().setColors(TXMPreferences.getInt(preferencesNode, result, ChartsEnginePreferences.RENDERING_COLORS_MODE), parts.size()); |
| 69 | 69 |
|
| 70 |
String cmd = String.format("barplot(%s, col=colors, names.arg=%s, horiz=F, las=2, ylab=\"%s\");\n", ssizes, snames, PartitionCoreMessages.numberOfWords); //$NON-NLS-1$
|
|
| 70 |
String cmd = String.format("barplot(%s, col=colors, names.arg=%s, horiz=F, las=2, ylab=\"%s\", xlab=\"%s\");\n", ssizes, snames, PartitionCoreMessages.numberOfWords, PartitionCoreMessages.part); //$NON-NLS-1$
|
|
| 71 | 71 |
|
| 72 | 72 |
// plot the chart |
| 73 | 73 |
this.getChartsEngine().plot(file, cmd, result, Utils.createPartitionDimensionsChartTitle(partitionDimensions), Utils.createPartitionDimensionsChartSubtitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle)); |
| tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1745) | ||
|---|---|---|
| 548 | 548 |
} |
| 549 | 549 |
|
| 550 | 550 |
f.setAccessible(true); |
| 551 |
this.getLastParametersFromHistory().remove(name); |
|
| 551 |
try {
|
|
| 552 |
this.getLastParametersFromHistory().remove(name); |
|
| 553 |
} |
|
| 554 |
catch (Exception e) {
|
|
| 555 |
// nothing to do if the stack is empty |
|
| 556 |
} |
|
| 552 | 557 |
} |
| 553 | 558 |
|
| 554 |
if(this.getLastParametersFromHistory().isEmpty()) {
|
|
| 555 |
this.parametersHistory.remove(this.parametersHistory.size() - 1); |
|
| 559 |
|
|
| 560 |
try {
|
|
| 561 |
if(this.getLastParametersFromHistory().isEmpty()) {
|
|
| 562 |
this.parametersHistory.remove(this.parametersHistory.size() - 1); |
|
| 563 |
} |
|
| 556 | 564 |
} |
| 565 |
catch (Exception e) {
|
|
| 566 |
// nothing to do if the stack is empty |
|
| 567 |
} |
|
| 557 | 568 |
} |
| 558 | 569 |
|
| 559 | 570 |
|
| 560 |
// /** |
|
| 561 |
// * Clears the parameters used for last computing. |
|
| 562 |
// * Dedicated to force a full recomputing. |
|
| 563 |
// * @throws Exception |
|
| 564 |
// */ |
|
| 565 |
// protected void clearLastParameters() {
|
|
| 566 |
// this.clearLastParameters(Parameter.COMPUTING); |
|
| 567 |
// } |
|
| 568 |
|
|
| 569 |
|
|
| 570 | 571 |
/** |
| 571 |
* Checks if a parameter value has changed since the n-2 computing. |
|
| 572 |
* This method permits to know, for example, if a parent that has already been computed was dirty before its computing, |
|
| 573 |
* then a child can adjust or not its computing, regarding to the parent state. |
|
| 574 |
* @param key |
|
| 575 |
* @param older |
|
| 576 |
* @return |
|
| 577 |
*/ |
|
| 578 |
// FIXME: SJ: should become useless after ChartResult changes |
|
| 579 |
// @Deprecated |
|
| 580 |
// public boolean hasParameterChanged(String key, boolean older) {
|
|
| 581 |
// if(older) {
|
|
| 582 |
// return this.hasParameterChanged(key, this.parametersHistory.get(this.parametersHistory.size() - 2)); |
|
| 583 |
// } |
|
| 584 |
// else {
|
|
| 585 |
// return this.hasParameterChanged(key); |
|
| 586 |
// } |
|
| 587 |
// } |
|
| 588 |
|
|
| 589 |
/** |
|
| 590 | 572 |
* Checks if a parameter value has changed since last computing. |
| 591 | 573 |
* @param key |
| 592 | 574 |
* @param parameterType |
| ... | ... | |
| 847 | 829 |
} |
| 848 | 830 |
|
| 849 | 831 |
|
| 832 |
/** |
|
| 833 |
* Gets the list of parameters used during last computing or null if the result has not been computed yet. |
|
| 834 |
* |
|
| 835 |
* @return |
|
| 836 |
*/ |
|
| 850 | 837 |
public HashMap<String, Object> getLastParametersFromHistory() {
|
| 851 | 838 |
try {
|
| 852 | 839 |
return this.parametersHistory.get(this.parametersHistory.size() - 1); |
| tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartsEngine.java (revision 1745) | ||
|---|---|---|
| 100 | 100 |
// FIXME: outer margin to not cut of title |
| 101 | 101 |
//cmd += "par(oma = c(10,2,2,2));\n"; //$NON-NLS-1$ |
| 102 | 102 |
|
| 103 |
// font size |
|
| 104 |
//cmd += "par(cex.main = 3.5);\n"; //$NON-NLS-1$ |
|
| 105 |
//cex.lab=1.5, cex.axis=1.5, cex.main=1.5, cex.sub=1.5 |
|
| 103 | 106 |
|
| 107 |
|
|
| 104 | 108 |
if(result != null) {
|
| 105 | 109 |
// draw grid |
| 106 | 110 |
if(result.isGridVisible()) {
|
Formats disponibles : Unified diff