Révision 1740
tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartCreator.java (revision 1740) | ||
---|---|---|
29 | 29 |
public void updateChart(ChartResult result) { |
30 | 30 |
|
31 | 31 |
Object chart = result.getChart(); |
32 |
// creates a new chart using a new file |
|
32 |
|
|
33 |
// creates a new chart but using the same file |
|
33 | 34 |
// FIXME: SJ to MD: this case should never happen, if it happens then a bug must fixed at another location |
34 |
// TODO: find the bug then just keep: this.createChartFile(result); |
|
35 |
// TODO: find the bug then just keep: this.createChartFile(result, (File)chart);
|
|
35 | 36 |
if (chart != null && chart instanceof File) { |
36 | 37 |
this.createChartFile(result, (File)chart); |
37 | 38 |
} |
38 |
// creates a new chart but using the same file
|
|
39 |
// creates a new chart using a new file
|
|
39 | 40 |
else { |
40 | 41 |
this.createChartFile(result); |
41 | 42 |
} |
42 |
|
|
43 |
// FIXME: using new file |
|
44 |
//this.createChartFile(resultData, preferencesNode); |
|
45 |
|
|
46 | 43 |
} |
47 | 44 |
|
48 | 45 |
@Override |
tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartsEngine.java (revision 1740) | ||
---|---|---|
5 | 5 |
import org.eclipse.core.runtime.IProgressMonitor; |
6 | 6 |
import org.rosuda.REngine.REXPMismatchException; |
7 | 7 |
import org.txm.chartsengine.core.ChartsEngine; |
8 |
import org.txm.chartsengine.core.results.ChartResult; |
|
8 | 9 |
import org.txm.chartsengine.r.core.preferences.RChartsEnginePreferences; |
9 |
import org.txm.core.preferences.TXMPreferences; |
|
10 | 10 |
import org.txm.stat.engine.r.RDevice; |
11 | 11 |
import org.txm.stat.engine.r.RWorkspaceRenderer; |
12 | 12 |
import org.txm.statsengine.core.StatException; |
... | ... | |
77 | 77 |
/** |
78 | 78 |
* Plots the specified expression using R workspace instance and current charts engine output format. |
79 | 79 |
* @param file |
80 |
* @param expression |
|
81 |
* @param device |
|
80 |
* @param cmd |
|
82 | 81 |
*/ |
83 |
public void plot(File file, String expression) { |
|
82 |
public void plot(File file, String cmd) { |
|
83 |
this.plot(file, cmd, null, null, null); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Plots the specified expression using R workspace instance and current charts engine output format. |
|
88 |
* @param file |
|
89 |
* @param cmd |
|
90 |
* @param result |
|
91 |
*/ |
|
92 |
public void plot(File file, String cmd, ChartResult result, String title, String subtitle) { |
|
84 | 93 |
try { |
85 |
RWorkspaceRenderer.getInstance().plot(file, expression, this.rDevice); |
|
94 |
if(result != null) { |
|
95 |
// draw grid |
|
96 |
if(result.isGridVisible()) { |
|
97 |
cmd += this.getGridPlotCmd(); |
|
98 |
} |
|
99 |
// draw title |
|
100 |
if(result.isTitleVisible()) { |
|
101 |
cmd += this.getTitlePlotCmd(title); |
|
102 |
cmd += this.getSubtitlePlotCmd(subtitle); |
|
103 |
} |
|
104 |
} |
|
105 |
RWorkspaceRenderer.getInstance().plot(file, cmd, this.rDevice); |
|
86 | 106 |
} |
87 | 107 |
catch(RWorkspaceException e) { |
88 | 108 |
// TODO Auto-generated catch block |
... | ... | |
98 | 118 |
} |
99 | 119 |
} |
100 | 120 |
|
121 |
|
|
101 | 122 |
/** |
102 | 123 |
* Returns a string that represents the R command to draw a title. |
103 | 124 |
* @param title |
tmp/org.txm.partition.core/src/org/txm/partition/core/messages/messages_fr.properties (revision 1740) | ||
---|---|---|
1 |
#TXM messages generated by the PluginMessagesManager class |
|
2 |
#Tue Dec 18 10:24:08 CET 2018 |
|
3 |
cantCreateDimensionsPartitionChartFileChartsEngineColonP0=** Impossible de créer le fichier du graphique de dimensions de partition (moteur de graphiques {0}) |
|
4 |
dimensionsColonP0=Dimensions \: {0} |
|
5 |
dimensionsOfTheP0PartitionInTheP1Corpus=Dimensions de la partition {0} dans le corpus {1} |
|
6 |
numberOfWords=Nombre de mots |
|
7 |
part=Partie |
|
8 |
parts=Partie(s) |
|
9 |
RESULT_TYPE=Propriétés |
|
10 |
sortedBySize=trié par taille |
|
11 |
t=t |
|
1 |
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/) |
|
2 |
#TXM messages generated by the PluginMessagesManager class |
|
3 |
#Tue Dec 18 10:24:08 CET 2018 |
|
4 |
|
|
5 |
RESULT_TYPE = Propriétés |
|
6 |
|
|
7 |
cantCreateDimensionsPartitionChartFileChartsEngineColonP0 = ** Impossible de créer le fichier du graphique de dimensions de partition (moteur de graphiques {0}) |
|
8 |
|
|
9 |
dimensionsColonP0 = Dimensions : {0} |
|
10 |
|
|
11 |
dimensionsOfTheP0PartitionInTheP1Corpus = Dimensions de la partition {0} dans le corpus {1} |
|
12 |
|
|
13 |
numberOfWords = Nombre de mots |
|
14 |
|
|
15 |
part = Partie |
|
16 |
|
|
17 |
parts = Partie(s) |
|
18 |
|
|
19 |
sortedBySize = triées par taille |
|
20 |
|
|
21 |
t = t |
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/base/Utils.java (revision 1740) | ||
---|---|---|
22 | 22 |
* @param displayPartsCountInTitle display or not the parts count in chart title |
23 | 23 |
* @return the title string |
24 | 24 |
*/ |
25 |
public static String createPartitionDimensionsChartTitle(PartitionDimensions partitionDimensions, boolean sortPartsBySize, boolean displayPartsCountInTitle) { |
|
26 |
|
|
27 |
String title = PartitionCoreMessages.bind(PartitionCoreMessages.dimensionsOfTheP0PartitionInTheP1Corpus, partitionDimensions.getParent().getSimpleName(), partitionDimensions.getCorpus().getSimpleName()); |
|
28 |
|
|
29 |
// FIXME |
|
30 |
// if(displayPartsCountInTitle) { |
|
31 |
// title += "\n(" + partitionDimensions.getPartsCount() + " " + PartitionCoreMessages.parts + ")"; //$NON-NLS-1$ //$NON-NLS-3$ |
|
32 |
// } |
|
33 |
// |
|
34 |
// if(sortPartsBySize) { |
|
35 |
// title += PartitionCoreMessages.sortedBySize; |
|
36 |
// } |
|
37 |
|
|
38 |
return title; |
|
25 |
public static String createPartitionDimensionsChartTitle(PartitionDimensions partitionDimensions) { |
|
26 |
return PartitionCoreMessages.bind(PartitionCoreMessages.dimensionsOfTheP0PartitionInTheP1Corpus, partitionDimensions.getParent().getSimpleName(), partitionDimensions.getCorpus().getSimpleName()); |
|
39 | 27 |
} |
40 | 28 |
|
41 | 29 |
|
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsBarChartCreator.java (revision 1740) | ||
---|---|---|
23 | 23 |
import org.txm.searchengine.cqp.corpus.Part; |
24 | 24 |
|
25 | 25 |
/** |
26 |
* Creates a partition dimensions bar chart from the specified <code>Partition</code> result. |
|
26 |
* Creates a partition dimensions bar chart from the specified <code>PartitionDimensions</code> result.
|
|
27 | 27 |
* @author sjacquot |
28 | 28 |
* |
29 | 29 |
*/ |
... | ... | |
94 | 94 |
|
95 | 95 |
|
96 | 96 |
// Create chart title |
97 |
chart.setTitle(Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle));
|
|
97 |
chart.setTitle(Utils.createPartitionDimensionsChartTitle(partitionDimensions)); |
|
98 | 98 |
|
99 | 99 |
|
100 | 100 |
|
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsPieChartCreator.java (revision 1740) | ||
---|---|---|
18 | 18 |
import org.txm.searchengine.cqp.corpus.Part; |
19 | 19 |
|
20 | 20 |
/** |
21 |
* Creates a partition dimensions pie chart from the specified <code>Partition</code> result. |
|
21 |
* Creates a partition dimensions pie chart from the specified <code>PartitionDimensions</code> result. |
|
22 |
* |
|
22 | 23 |
* @author sjacquot |
23 | 24 |
* |
24 | 25 |
*/ |
25 |
|
|
26 | 26 |
public class JFCPartitionDimensionsPieChartCreator extends JFCChartCreator { |
27 | 27 |
|
28 | 28 |
|
... | ... | |
85 | 85 |
} |
86 | 86 |
|
87 | 87 |
// Create chart title |
88 |
chart.setTitle(Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle));
|
|
88 |
chart.setTitle(Utils.createPartitionDimensionsChartTitle(partitionDimensions)); |
|
89 | 89 |
|
90 | 90 |
super.updateChart(result); |
91 | 91 |
|
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java (revision 1740) | ||
---|---|---|
14 | 14 |
import org.txm.utils.logger.Log; |
15 | 15 |
|
16 | 16 |
/** |
17 |
* Creates a partition dimensions bar chart from the specified <code>Partition</code> result. |
|
17 |
* Creates a partition dimensions bar chart from the specified <code>PartitionDimensions</code> result.
|
|
18 | 18 |
* @author sjacquot |
19 | 19 |
* |
20 | 20 |
*/ |
... | ... | |
69 | 69 |
|
70 | 70 |
String ylab = PartitionCoreMessages.numberOfWords; |
71 | 71 |
|
72 |
String cmd = ""; |
|
73 |
|
|
74 | 72 |
// FIXME: margin |
75 | 73 |
//cmd += "par(mar=c(5.5,5,5,5));\n"; //$NON-NLS-1$ |
76 | 74 |
|
... | ... | |
79 | 77 |
|
80 | 78 |
|
81 | 79 |
|
82 |
// cmd += "barplot(" + ssizes + ", col=colors, names.arg=" + snames + //$NON-NLS-1$ //$NON-NLS-2$ |
|
80 |
// String cmd += "barplot(" + ssizes + ", col=colors, names.arg=" + snames + //$NON-NLS-1$ //$NON-NLS-2$
|
|
83 | 81 |
// ", main=\"" + title + "\", horiz=F, las=2, ylab=\"" + ylab + "\");\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
84 | 82 |
|
85 |
cmd += "barplot(" + ssizes + ", col=colors, names.arg=" + snames + //$NON-NLS-1$ //$NON-NLS-2$
|
|
83 |
String cmd = "barplot(" + ssizes + ", col=colors, names.arg=" + snames + //$NON-NLS-1$ //$NON-NLS-2$
|
|
86 | 84 |
", horiz=F, las=2, ylab=\"" + ylab + "\");\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
87 | 85 |
|
88 |
// draw grid |
|
89 |
if(result.isGridVisible()) { |
|
90 |
cmd += this.getChartsEngine().getGridPlotCmd(); |
|
91 |
} |
|
92 | 86 |
|
93 |
// draw title |
|
94 |
if(result.isTitleVisible()) { |
|
95 |
cmd += this.getChartsEngine().getTitlePlotCmd(Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle)); |
|
96 |
} |
|
97 |
|
|
98 | 87 |
// plot the chart |
99 |
this.getChartsEngine().plot(file, cmd); |
|
88 |
this.getChartsEngine().plot(file, cmd, result, Utils.createPartitionDimensionsChartTitle(partitionDimensions), Utils.createPartitionDimensionsChartSubtitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle));
|
|
100 | 89 |
|
101 |
|
|
102 | 90 |
} |
103 | 91 |
catch(Exception e) { |
104 | 92 |
Log.severe(PartitionCoreMessages.bind(PartitionCoreMessages.cantCreateDimensionsPartitionChartFileChartsEngineColonP0, RChartsEngine.DESCRIPTION) + e); |
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsPieChartCreator.java (revision 1740) | ||
---|---|---|
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; |
... | ... | |
14 | 13 |
import org.txm.utils.logger.Log; |
15 | 14 |
|
16 | 15 |
/** |
17 |
* Creates a partition dimensions pie chart from the specified <code>Partition</code> result. |
|
16 |
* Creates a partition dimensions pie chart from the specified <code>PartitionDimensions</code> result. |
|
17 |
* |
|
18 | 18 |
* @author sjacquot |
19 | 19 |
* |
20 | 20 |
*/ |
... | ... | |
56 | 56 |
} |
57 | 57 |
ssizes += ")"; //$NON-NLS-1$ |
58 | 58 |
|
59 |
String title = ""; |
|
60 |
if(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE)) { |
|
61 |
title = Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle); |
|
62 |
} |
|
63 |
|
|
64 | 59 |
// colors |
65 | 60 |
//this.getChartsEngine().setColors(result.getRenderingColorsMode(), 1); |
66 | 61 |
// FIXME: one color by part |
... | ... | |
70 | 65 |
String ylab = PartitionCoreMessages.numberOfWords; |
71 | 66 |
|
72 | 67 |
String cmd = "pie(" + ssizes + ", col=colors, labels=" + snames + //$NON-NLS-1$ //$NON-NLS-2$ |
73 |
", main=\"" + title + "\", horiz=F, las=2, ylab=\"" + ylab + "\")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
68 |
", horiz=F, las=2, ylab=\"" + ylab + "\")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
74 | 69 |
|
75 |
|
|
76 |
((RChartsEngine) this.chartsEngine).plot(file, cmd); |
|
70 |
// plot the chart |
|
71 |
this.getChartsEngine().plot(file, cmd, result, Utils.createPartitionDimensionsChartTitle(partitionDimensions), Utils.createPartitionDimensionsChartSubtitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle)); |
|
72 |
|
|
77 | 73 |
} |
78 | 74 |
catch(Exception e) { |
79 | 75 |
Log.severe(PartitionCoreMessages.bind(PartitionCoreMessages.cantCreateDimensionsPartitionChartFileChartsEngineColonP0, RChartsEngine.DESCRIPTION) + e); |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 1740) | ||
---|---|---|
127 | 127 |
// Toolbar |
128 | 128 |
this.chartToolBar = new ChartEditorToolBar(this, this.getFirstLineComposite(), null, SWT.FLAT | SWT.RIGHT); |
129 | 129 |
this.getFirstLineComposite().getLayout().numColumns += 1; |
130 |
//this.chartToolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED)); |
|
131 | 130 |
|
132 | 131 |
this.exportChartEditorViewButton = this.chartToolBar.getItemByContributionId("exportChartEditorView"); //$NON-NLS-1$ |
133 | 132 |
this.copyChartViewToClipboardButton = this.chartToolBar.getItemByContributionId("copyChartViewToClipboard"); //$NON-NLS-1$ |
134 | 133 |
|
135 | 134 |
|
136 | 135 |
// Advanced tool bar |
137 |
//this.advancedToolBarComposite = new Composite(parent, SWT.NONE); |
|
138 | 136 |
Group group = this.topToolBar.installGroup(ChartsUIMessages.rendering, ChartsUIMessages.showHideRenderingParameters, |
139 | 137 |
"platform:/plugin/org.txm.chartsengine.rcp/icons/show_rendering_parameters.png", //$NON-NLS-1$ |
140 | 138 |
"platform:/plugin/org.txm.chartsengine.rcp/icons/hide_rendering_parameters.png", //$NON-NLS-1$ |
141 | 139 |
false); |
142 | 140 |
this.advancedChartToolBar = new AdvancedChartEditorToolBar(this, group, this.getParametersGroupsComposite(), SWT.FLAT); |
143 |
//this.advancedChartToolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); |
|
144 |
// this.advancedToolBarComposite.pack(true); |
|
145 | 141 |
|
146 |
// Remove parent composites |
|
147 |
//TODO MD: hack ? |
|
148 |
//this.resultArea.dispose(); |
|
149 |
|
|
150 | 142 |
// Chart composite |
151 | 143 |
this.chartComposite = SWTChartsComponentsProvider.getComponentsProvider(this.getResult().getChartsEngine()).createComposite(this, this.getResultArea()); |
152 | 144 |
|
153 | 145 |
GridData gd = new GridData(GridData.FILL_BOTH); |
154 |
//// gd.grabExcessVerticalSpace = true; |
|
155 |
//// gd.grabExcessHorizontalSpace = true; |
|
156 |
// //gd.horizontalSpan = 2; // 2 for match the command parameters toolbar AND the chart toolbar |
|
157 | 146 |
this.chartComposite.setLayoutData(gd); |
158 | 147 |
|
159 |
//this.chartComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED)); |
|
160 |
|
|
161 |
//this.getResultArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_YELLOW)); |
|
162 |
|
|
163 |
//this.parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED)); |
|
164 |
|
|
165 |
// Re-add the bottom toolbar |
|
166 |
//TODO MD: hack ? |
|
167 |
//this.bottomToolBar = new TXMEditorToolBar(this, SWT.FLAT, "bottom"); |
|
168 |
|
|
169 | 148 |
// FIXME: open dialog box message if the composite doesn't contain any chart (typically when the charts engine doesn't contain chart creator for the specified result data type) |
170 | 149 |
// if(composite.getChart() == null) { |
171 | 150 |
// MessageDialog.openWarning(parent.getShell(), "Warning", "Current charts engine can not create chart for " + this.getResultData().getClass().getSimpleName() + " result type. You can set another charts engine in the preferences."); |
... | ... | |
175 | 154 |
//this.composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); |
176 | 155 |
//parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); |
177 | 156 |
|
178 |
//this.refresh(false); |
|
179 |
// |
|
180 |
// } |
|
181 | 157 |
|
182 | 158 |
// subclasses manual creation |
183 | 159 |
this.__createPartControl(); |
Formats disponibles : Unified diff