Révision 1737
| tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 1737) | ||
|---|---|---|
| 44 | 44 |
super(chartEditor, parent, subWidgetsComposite, style, AdvancedChartEditorToolBar.ID); |
| 45 | 45 |
|
| 46 | 46 |
|
| 47 |
final ToolItem showTitle = new ToolItem(this, SWT.CHECK); |
|
| 47 |
final ToolItem showTitleButton = new ToolItem(this, SWT.CHECK);
|
|
| 48 | 48 |
//showTitle.setText(SWTComponentsProviderMessages.showhideTitle); |
| 49 |
showTitle.setImage(IImageKeys.getImage(getClass(), "icons/show_title.png")); |
|
| 50 |
showTitle.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_title_disabled.png")); |
|
| 51 |
showTitle.setToolTipText(ChartsUIMessages.showhideTitle); |
|
| 49 |
showTitleButton.setImage(IImageKeys.getImage(getClass(), "icons/show_title.png"));
|
|
| 50 |
showTitleButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_title_disabled.png"));
|
|
| 51 |
showTitleButton.setToolTipText(ChartsUIMessages.showhideTitle);
|
|
| 52 | 52 |
|
| 53 | 53 |
if(!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_TITLE)) {
|
| 54 |
showTitle.setSelection(chartEditor.getResult().isTitleVisible()); |
|
| 54 |
showTitleButton.setSelection(chartEditor.getResult().isTitleVisible());
|
|
| 55 | 55 |
} |
| 56 | 56 |
// disable if not managed by the command |
| 57 | 57 |
else {
|
| 58 |
showTitle.setEnabled(false); |
|
| 58 |
showTitleButton.setEnabled(false);
|
|
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 | 61 |
|
| 62 |
final ToolItem showLegend = new ToolItem(this, SWT.CHECK); |
|
| 62 |
final ToolItem showLegendButton = new ToolItem(this, SWT.CHECK);
|
|
| 63 | 63 |
//showLegend.setText(SWTComponentsProviderMessages.showhideLegend); |
| 64 |
showLegend.setImage(IImageKeys.getImage(getClass(), "icons/show_legend.png")); |
|
| 65 |
showLegend.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_legend_disabled.png")); |
|
| 66 |
showLegend.setToolTipText(ChartsUIMessages.showhideLegend); |
|
| 64 |
showLegendButton.setImage(IImageKeys.getImage(getClass(), "icons/show_legend.png"));
|
|
| 65 |
showLegendButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_legend_disabled.png"));
|
|
| 66 |
showLegendButton.setToolTipText(ChartsUIMessages.showhideLegend);
|
|
| 67 | 67 |
|
| 68 | 68 |
if(!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_LEGEND)) {
|
| 69 |
showLegend.setSelection(chartEditor.getResult().isLegendVisible()); |
|
| 69 |
showLegendButton.setSelection(chartEditor.getResult().isLegendVisible());
|
|
| 70 | 70 |
} |
| 71 | 71 |
// disable if not managed by the command |
| 72 | 72 |
else {
|
| 73 |
showLegend.setEnabled(false); |
|
| 73 |
showLegendButton.setEnabled(false);
|
|
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
|
| 77 |
final ToolItem showGrid = new ToolItem(this, SWT.CHECK); |
|
| 77 |
final ToolItem showGridButton = new ToolItem(this, SWT.CHECK);
|
|
| 78 | 78 |
//showGrid.setText(SWTComponentsProviderMessages.showhideGrid); |
| 79 |
showGrid.setImage(IImageKeys.getImage(getClass(), "icons/show_grid.png")); |
|
| 80 |
showGrid.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_grid_disabled.png")); |
|
| 81 |
showGrid.setToolTipText(ChartsUIMessages.showhideGrid); |
|
| 79 |
showGridButton.setImage(IImageKeys.getImage(getClass(), "icons/show_grid.png"));
|
|
| 80 |
showGridButton.setDisabledImage(IImageKeys.getImage(getClass(), "icons/show_grid_disabled.png"));
|
|
| 81 |
showGridButton.setToolTipText(ChartsUIMessages.showhideGrid);
|
|
| 82 | 82 |
|
| 83 | 83 |
if(!chartEditor.getResult().isEmptyPreference(ChartsEnginePreferences.SHOW_GRID)) {
|
| 84 |
showGrid.setSelection(chartEditor.getResult().isGridVisible()); |
|
| 84 |
showGridButton.setSelection(chartEditor.getResult().isGridVisible());
|
|
| 85 | 85 |
} |
| 86 | 86 |
// disable if not managed by the command |
| 87 | 87 |
else {
|
| 88 |
showGrid.setEnabled(false); |
|
| 88 |
showGridButton.setEnabled(false);
|
|
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 | 91 |
|
| ... | ... | |
| 216 | 216 |
|
| 217 | 217 |
boolean update = true; |
| 218 | 218 |
|
| 219 |
if(e.getSource() == showTitle) {
|
|
| 220 |
getEditorPart().getResult().setTitleVisible(showTitle.getSelection()); |
|
| 219 |
|
|
| 220 |
// FIXME: SJ: title, legend, grid visibility etc. should use the autoUpdateEditor annotation parameters copy functions |
|
| 221 |
if(e.getSource() == showTitleButton) {
|
|
| 222 |
getEditorPart().getResult().setTitleVisible(showTitleButton.getSelection()); |
|
| 221 | 223 |
} |
| 222 |
else if(e.getSource() == showLegend) {
|
|
| 223 |
getEditorPart().getResult().setLegendVisible(showLegend.getSelection()); |
|
| 224 |
else if(e.getSource() == showLegendButton) {
|
|
| 225 |
getEditorPart().getResult().setLegendVisible(showLegendButton.getSelection());
|
|
| 224 | 226 |
} |
| 225 |
else if(e.getSource() == showGrid) {
|
|
| 226 |
getEditorPart().getResult().setGridVisible(showGrid.getSelection()); |
|
| 227 |
else if(e.getSource() == showGridButton) {
|
|
| 228 |
getEditorPart().getResult().setGridVisible(showGridButton.getSelection());
|
|
| 227 | 229 |
} |
| 228 | 230 |
else if(e.getSource() == renderingModeCombo) {
|
| 229 | 231 |
getEditorPart().getResult().setRenderingColorsMode(renderingModeCombo.getSelectionIndex()); |
| 230 | 232 |
} |
| 233 |
// end of FIXME |
|
| 234 |
|
|
| 235 |
|
|
| 231 | 236 |
else if(e.getSource() == fontCombo || e.getSource() == fontSizeCombo) {
|
| 232 | 237 |
getEditorPart().getResult().setFont("1|" + fontCombo.getItem(fontCombo.getSelectionIndex()) + "|" + fontSizeCombo.getItem(fontSizeCombo.getSelectionIndex()) + "|0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
| 233 | 238 |
} |
| ... | ... | |
| 254 | 259 |
|
| 255 | 260 |
} |
| 256 | 261 |
}; |
| 257 |
showTitle.addSelectionListener(listener); |
|
| 258 |
showLegend.addSelectionListener(listener); |
|
| 259 |
showGrid.addSelectionListener(listener); |
|
| 262 |
showTitleButton.addSelectionListener(listener);
|
|
| 263 |
showLegendButton.addSelectionListener(listener);
|
|
| 264 |
showGridButton.addSelectionListener(listener);
|
|
| 260 | 265 |
renderingModeCombo.addSelectionListener(listener); |
| 261 | 266 |
fontCombo.addSelectionListener(listener); |
| 262 | 267 |
fontSizeCombo.addSelectionListener(listener); |
| tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swt/SVGComposite.java (revision 1737) | ||
|---|---|---|
| 54 | 54 |
try {
|
| 55 | 55 |
if (ValidateXml.test(file)) {
|
| 56 | 56 |
this.getPanel().loadSVGDocument(file.toURL().toExternalForm()); |
| 57 |
} else {
|
|
| 58 |
Log.severe("** Malformed SVG file: "+file);
|
|
| 57 |
} |
|
| 58 |
else {
|
|
| 59 |
Log.severe(TXMCoreMessages.bind("** Malformed SVG file: {0}.", file));
|
|
| 59 | 60 |
this.getPanel().resetView(); |
| 60 | 61 |
} |
| 61 | 62 |
} |
| tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1737) | ||
|---|---|---|
| 1276 | 1276 |
if (targetField != null) {
|
| 1277 | 1277 |
targetField.setAccessible(true); |
| 1278 | 1278 |
targetField.set(this, value); |
| 1279 |
|
|
| 1280 |
// Log |
|
| 1281 |
String message = "TXMResult.setParameter(): " + this.getClass().getSimpleName() + ": setting parameter " + key + " = " + value; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
| 1282 |
Log.finest(message); |
|
| 1283 |
|
|
| 1279 | 1284 |
} |
| 1280 | 1285 |
else if (this.parent != null && propagateToParent) {
|
| 1281 | 1286 |
this.parent.setParameter(key, value, propagateToParent); |
| tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java (revision 1737) | ||
|---|---|---|
| 57 | 57 |
ssizes += ")"; //$NON-NLS-1$ |
| 58 | 58 |
|
| 59 | 59 |
// Create chart title |
| 60 |
String title = ""; |
|
| 61 |
if(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE)) {
|
|
| 62 |
title = Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle); |
|
| 63 |
} |
|
| 60 |
// String title = "";
|
|
| 61 |
// if(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE)) {
|
|
| 62 |
// title = Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle);
|
|
| 63 |
// }
|
|
| 64 | 64 |
|
| 65 | 65 |
// colors |
| 66 | 66 |
this.getChartsEngine().setColors(result.getRenderingColorsMode(), 1); |
| ... | ... | |
| 79 | 79 |
|
| 80 | 80 |
|
| 81 | 81 |
|
| 82 |
// cmd += "barplot(" + ssizes + ", col=colors, names.arg=" + snames + //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 83 |
// ", 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 |
", main=\"" + title + "\", horiz=F, las=2, ylab=\"" + ylab + "\");\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
| 84 |
|
|
| 86 |
", horiz=F, las=2, ylab=\"" + ylab + "\");\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
| 87 |
|
|
| 88 |
// draw grid |
|
| 85 | 89 |
if(result.isGridVisible()) {
|
| 86 | 90 |
cmd += this.getChartsEngine().getGridPlotCmd(); |
| 87 | 91 |
} |
| 88 | 92 |
|
| 93 |
// draw title |
|
| 94 |
if(result.isTitleVisible()) {
|
|
| 95 |
cmd += this.getChartsEngine().getTitlePlotCmd(Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle)); |
|
| 96 |
} |
|
| 89 | 97 |
|
| 90 |
((RChartsEngine) this.chartsEngine).plot(file, cmd); |
|
| 98 |
// plot the chart |
|
| 99 |
this.getChartsEngine().plot(file, cmd); |
|
| 91 | 100 |
|
| 92 | 101 |
|
| 93 | 102 |
} |
| tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/themes/highcharts/renderers/ProgressionItemSelectionRenderer.java (revision 1737) | ||
|---|---|---|
| 38 | 38 |
* Stack to store selected items to draw at last, over others items. |
| 39 | 39 |
*/ |
| 40 | 40 |
protected ArrayList itemsToDrawAtLast; |
| 41 |
|
|
| 41 |
|
|
| 42 | 42 |
/** |
| 43 | 43 |
* additional series informations to show in tooltips |
| 44 | 44 |
*/ |
| ... | ... | |
| 78 | 78 |
String hex = "#" + Integer.toHexString(color.getRGB()).substring(2); |
| 79 | 79 |
XYSeriesCollection xyDataset = (XYSeriesCollection) dataset; |
| 80 | 80 |
|
| 81 |
//
|
|
| 82 |
// // FIXME: test affichage des concordances des occurrences directement dans le tooltip
|
|
| 83 |
// // Progression
|
|
| 84 |
// String concordanceStr = "";
|
|
| 81 |
// |
|
| 82 |
// // FIXME: test affichage des concordances des occurrences directement dans le tooltip |
|
| 83 |
// // Progression |
|
| 84 |
// String concordanceStr = ""; |
|
| 85 | 85 |
|
| 86 |
// if(renderer.getChartType() == ChartsEngine.CHART_TYPE_PROGRESSION) {
|
|
| 87 |
// try {
|
|
| 88 |
// Progression progression = ((Progression)renderer.getItemSelector().getResultData());
|
|
| 89 |
// //System.out.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() query: " + progression.getQueries().get(xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey())));
|
|
| 90 |
// Property analysisProperty = progression.
|
|
| 91 |
// getCorpus().
|
|
| 92 |
// getProperty("word");
|
|
| 93 |
// List<Property> viewProperties = new ArrayList<Property>();
|
|
| 94 |
// viewProperties.add(progression.
|
|
| 95 |
// getCorpus().
|
|
| 96 |
// getProperty("word"));
|
|
| 97 |
// ReferencePattern referencePattern = new ReferencePattern();
|
|
| 98 |
// ReferencePattern refAnalysePattern = new ReferencePattern();
|
|
| 99 |
// Concordance concordance = new Concordance(progression.getCorpus(), progression.getQueries().get(xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey())), analysisProperty, viewProperties, referencePattern, refAnalysePattern, 10, 10);
|
|
| 100 |
//
|
|
| 101 |
// System.err.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() concordance nlines: " + concordance.getNLines());
|
|
| 102 |
// System.err.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() item position: " + (xyDataset.getSeries(series).getY(item).intValue() - 1));
|
|
| 103 |
//
|
|
| 104 |
//
|
|
| 105 |
//
|
|
| 106 |
// Line line = concordance.getLines(xyDataset.getSeries(series).getY(item).intValue() - 1, xyDataset.getSeries(series).getY(item).intValue() - 1).get(0);
|
|
| 107 |
// concordanceStr = "<p>" + line.leftContextToString() + " <b>" + line.keywordToString() + "</b> " + line.rightContextToString() + "</p>";
|
|
| 108 |
// //xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey())
|
|
| 109 |
// }
|
|
| 110 |
// catch(CqiClientException e) {
|
|
| 111 |
// // TODO Auto-generated catch block
|
|
| 112 |
// e.printStackTrace();
|
|
| 113 |
// }
|
|
| 114 |
// catch(IOException e) {
|
|
| 115 |
// // TODO Auto-generated catch block
|
|
| 116 |
// e.printStackTrace();
|
|
| 117 |
// }
|
|
| 118 |
// catch(CqiServerError e) {
|
|
| 119 |
// // TODO Auto-generated catch block
|
|
| 120 |
// e.printStackTrace();
|
|
| 121 |
// }
|
|
| 122 |
// }
|
|
| 86 |
// if(renderer.getChartType() == ChartsEngine.CHART_TYPE_PROGRESSION) {
|
|
| 87 |
// try {
|
|
| 88 |
// Progression progression = ((Progression)renderer.getItemSelector().getResultData()); |
|
| 89 |
// //System.out.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() query: " + progression.getQueries().get(xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey())));
|
|
| 90 |
// Property analysisProperty = progression. |
|
| 91 |
// getCorpus(). |
|
| 92 |
// getProperty("word");
|
|
| 93 |
// List<Property> viewProperties = new ArrayList<Property>(); |
|
| 94 |
// viewProperties.add(progression. |
|
| 95 |
// getCorpus(). |
|
| 96 |
// getProperty("word"));
|
|
| 97 |
// ReferencePattern referencePattern = new ReferencePattern(); |
|
| 98 |
// ReferencePattern refAnalysePattern = new ReferencePattern(); |
|
| 99 |
// Concordance concordance = new Concordance(progression.getCorpus(), progression.getQueries().get(xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey())), analysisProperty, viewProperties, referencePattern, refAnalysePattern, 10, 10); |
|
| 100 |
// |
|
| 101 |
// System.err.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() concordance nlines: " + concordance.getNLines());
|
|
| 102 |
// System.err.println("ItemSelectionXYStepRenderer.initToolTipGenerator(...).new XYToolTipGenerator() {...}.generateToolTip() item position: " + (xyDataset.getSeries(series).getY(item).intValue() - 1));
|
|
| 103 |
// |
|
| 104 |
// |
|
| 105 |
// |
|
| 106 |
// Line line = concordance.getLines(xyDataset.getSeries(series).getY(item).intValue() - 1, xyDataset.getSeries(series).getY(item).intValue() - 1).get(0); |
|
| 107 |
// concordanceStr = "<p>" + line.leftContextToString() + " <b>" + line.keywordToString() + "</b> " + line.rightContextToString() + "</p>"; |
|
| 108 |
// //xyDataset.getSeriesIndex(xyDataset.getSeries(series).getKey()) |
|
| 109 |
// } |
|
| 110 |
// catch(CqiClientException e) {
|
|
| 111 |
// // TODO Auto-generated catch block |
|
| 112 |
// e.printStackTrace(); |
|
| 113 |
// } |
|
| 114 |
// catch(IOException e) {
|
|
| 115 |
// // TODO Auto-generated catch block |
|
| 116 |
// e.printStackTrace(); |
|
| 117 |
// } |
|
| 118 |
// catch(CqiServerError e) {
|
|
| 119 |
// // TODO Auto-generated catch block |
|
| 120 |
// e.printStackTrace(); |
|
| 121 |
// } |
|
| 122 |
// } |
|
| 123 | 123 |
|
| 124 |
if (xyDataset.getSeriesCount() > series) {
|
|
| 125 |
String token = xyDataset.getSeriesKey(series).toString(); |
|
| 126 |
token = token.substring(0, token.lastIndexOf(" "));
|
|
| 127 |
int tokenCount = xyDataset.getSeries(series).getItemCount() - 2; // -2 for the 0 point and the dummy last point |
|
| 124 |
String token = xyDataset.getSeriesKey(series).toString(); |
|
| 125 |
token = token.substring(0, token.lastIndexOf(" "));
|
|
| 126 |
int tokenCount = xyDataset.getSeries(series).getItemCount() - 2; // -2 for the 0 point and the dummy last point |
|
| 128 | 127 |
|
| 129 |
return CustomHTMLToolTip.getDefaultHTMLBody(renderer, hex) + "<p><span style=\"color: " + hex + ";\">" + token + "</span> <b>(" + RendererUtils.valuesNumberFormat.format(xyDataset.getSeries(series).getY(item)) + " / " + tokenCount + ")</b>"
|
|
| 130 |
+ "</p></body><html>"; |
|
| 131 |
|
|
| 132 |
// FIXME: test contexts in tool tip |
|
| 133 |
// return CustomHTMLToolTip.getDefaultHTMLBody(renderer, hex) + "<p><span style=\"color: " + hex + ";\">" + xyDataset.getSeriesKey(series) |
|
| 134 |
// + "</span></p><p><b>" + valuesNumberFormat.format(xyDataset.getSeries(series).getY(item)) + ChartsEngineMessages.ChartsEngine_LABEL_VALUE_SEPARATORS |
|
| 135 |
// + " </b><b>" + valuesNumberFormat.format(xyDataset.getSeries(series).getX(item)) + "</b>" |
|
| 136 |
// + concordanceStr |
|
| 137 |
// + "</p></body><html>"; |
|
| 138 |
} |
|
| 128 |
return CustomHTMLToolTip.getDefaultHTMLBody(renderer, hex) + "<p><span style=\"color: " + hex + ";\">" + token + "</span> <b>(" + RendererUtils.valuesNumberFormat.format(xyDataset.getSeries(series).getY(item)) + " / " + tokenCount + ")</b>"
|
|
| 129 |
+ "</p></body><html>"; |
|
| 139 | 130 |
|
| 140 |
return ""; |
|
| 131 |
// FIXME: test contexts in tool tip |
|
| 132 |
// return CustomHTMLToolTip.getDefaultHTMLBody(renderer, hex) + "<p><span style=\"color: " + hex + ";\">" + xyDataset.getSeriesKey(series) |
|
| 133 |
// + "</span></p><p><b>" + valuesNumberFormat.format(xyDataset.getSeries(series).getY(item)) + ChartsEngineMessages.ChartsEngine_LABEL_VALUE_SEPARATORS |
|
| 134 |
// + " </b><b>" + valuesNumberFormat.format(xyDataset.getSeries(series).getX(item)) + "</b>" |
|
| 135 |
// + concordanceStr |
|
| 136 |
// + "</p></body><html>"; |
|
| 137 |
|
|
| 141 | 138 |
} |
| 142 | 139 |
}); |
| 143 | 140 |
} |
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
| 147 | 144 |
@Override |
| 148 | 145 |
public Paint getItemPaint(int series, int item) {
|
| 149 | 146 |
|
| ... | ... | |
| 157 | 154 |
return new Color(color.getRed(), color.getGreen(), color.getBlue(), 195); |
| 158 | 155 |
} |
| 159 | 156 |
// Multiple item selection |
| 160 |
// else if(this.itemSelector.isMultipleSelectedItem(series, item)) {
|
|
| 161 |
// // FIXME: rendering tests
|
|
| 162 |
// return new Color(130, 130, 130, 195);
|
|
| 163 |
// //return new Color(color.getRed(), color.getGreen(), color.getBlue(), 140);
|
|
| 164 |
// }
|
|
| 157 |
// else if(this.itemSelector.isMultipleSelectedItem(series, item)) {
|
|
| 158 |
// // FIXME: rendering tests |
|
| 159 |
// return new Color(130, 130, 130, 195); |
|
| 160 |
// //return new Color(color.getRed(), color.getGreen(), color.getBlue(), 140); |
|
| 161 |
// } |
|
| 165 | 162 |
|
| 166 | 163 |
} |
| 167 |
|
|
| 164 |
|
|
| 168 | 165 |
return color; |
| 169 | 166 |
} |
| 170 | 167 |
|
| ... | ... | |
| 174 | 171 |
|
| 175 | 172 |
Shape s = super.getItemShape(series, item); |
| 176 | 173 |
AffineTransform t = new AffineTransform(); |
| 177 |
|
|
| 174 |
|
|
| 178 | 175 |
// shapes are being patched and its not the first false point |
| 179 | 176 |
if (item != 0 && additionalShapesScale != null) {
|
| 180 | 177 |
if (additionalShapesScale.size() > series) {
|
| ... | ... | |
| 189 | 186 |
} |
| 190 | 187 |
} |
| 191 | 188 |
} |
| 192 |
|
|
| 189 |
|
|
| 193 | 190 |
// TODO: find better way to not draw a shape |
| 194 | 191 |
// If not selected item, reduce the shape therefore it will be hidden by the lines chart |
| 195 | 192 |
if(!this.multipleItemsSelector.isMouseOverItem(series, item) && !this.multipleItemsSelector.isSelectedItem(series, item)) {
|
| 196 | 193 |
t.setToScale(0.1, 0.1); |
| 197 | 194 |
} |
| 198 | 195 |
// FIXME: Multiple selection |
| 199 |
// else if(this.itemSelector.isMultipleSelectedItem(series, item)) {
|
|
| 200 |
////
|
|
| 201 |
// // Add a background rectangle to the label selected item
|
|
| 202 |
// XYSeriesCollection dataset = (XYSeriesCollection) this.getPlot().getDataset();
|
|
| 203 |
//
|
|
| 204 |
// Graphics2D graphics = ((Graphics2D) this.chartPanel.getGraphics());
|
|
| 205 |
//
|
|
| 206 |
// // FIXME: get graphics by creating an image insetad of passing the chart panel to this renderer
|
|
| 207 |
//// BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
|
|
| 208 |
//// Graphics2D graphics = img.createGraphics();
|
|
| 209 |
// // FIXME: rendering quality tests
|
|
| 210 |
//// RenderingHints rh = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
|
| 211 |
//// rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
| 212 |
//// rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
|
| 213 |
//// rh.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
|
| 214 |
//// graphics.setRenderingHints(rh);
|
|
| 215 |
//
|
|
| 216 |
// Font font = this.getItemLabelFont(series, item);
|
|
| 217 |
// String label = valuesNumberFormat.format(dataset.getSeries(series).getY(item)) + " / " + (dataset.getSeries(series).getItemCount() - 2); //$NON-NLS-1$ // -2 for the 0 point and the dummy last point;
|
|
| 218 |
//
|
|
| 219 |
// GlyphVector v = font.createGlyphVector(graphics.getFontMetrics(font).getFontRenderContext(), label);
|
|
| 220 |
// Shape labelShape = v.getOutline();
|
|
| 221 |
// //Rectangle2D labelBounds = v.getVisualBounds();
|
|
| 222 |
//
|
|
| 223 |
// Rectangle2D labelBounds = font.getStringBounds(label, graphics.getFontRenderContext());
|
|
| 224 |
//
|
|
| 225 |
// // FIXME : not rounded rectangle version
|
|
| 226 |
//// Shape labelBackground = new Rectangle2D.Double(-bounds.getWidth() / 2, -s.getBounds2D().getHeight() / 2 + 1, bounds.getWidth() + 4, bounds.getHeight() / 2 + 8);
|
|
| 227 |
//
|
|
| 228 |
// //Rectangle2D labelBounds = font.getStringBounds(label, graphics.getFontRenderContext());
|
|
| 229 |
//
|
|
| 230 |
// //Rectangle labelBounds = labelShape.getBounds();
|
|
| 231 |
//
|
|
| 232 |
// //Shape labelBackground = new RoundRectangle2D.Double(-(labelBounds.getWidth() + 4) / 2, -s.getBounds2D().getHeight() / 2 + 1, labelBounds.getWidth() + 8, labelBounds.getHeight() / 2 + 10, 5, 5);
|
|
| 233 |
// double width = labelBounds.getWidth() + 10;
|
|
| 234 |
// double height = labelBounds.getHeight() + 10;
|
|
| 235 |
// Shape labelBackground = new RoundRectangle2D.Double(-width / 2, -height / 2 - 15, width, height, 5, 5);
|
|
| 236 |
//
|
|
| 237 |
// AffineTransform t2 = new AffineTransform();
|
|
| 238 |
// t2.setToScale(0.9, 0.9);
|
|
| 239 |
// Shape labelBackground2 = t2.createTransformedShape(labelBackground);
|
|
| 240 |
//
|
|
| 241 |
//
|
|
| 242 |
// Area a = new Area(s);
|
|
| 243 |
// a.add(new Area(labelBackground));
|
|
| 244 |
// //a.add(new Area(labelBackground2));
|
|
| 245 |
// //a.add(new Area(labelShape));
|
|
| 246 |
//
|
|
| 247 |
// s = a;
|
|
| 248 |
// //t.setToScale(1.5, 1.5);
|
|
| 249 |
//
|
|
| 250 |
// //return a;
|
|
| 251 |
//
|
|
| 252 |
// }
|
|
| 196 |
// else if(this.itemSelector.isMultipleSelectedItem(series, item)) {
|
|
| 197 |
//// |
|
| 198 |
// // Add a background rectangle to the label selected item |
|
| 199 |
// XYSeriesCollection dataset = (XYSeriesCollection) this.getPlot().getDataset(); |
|
| 200 |
// |
|
| 201 |
// Graphics2D graphics = ((Graphics2D) this.chartPanel.getGraphics()); |
|
| 202 |
// |
|
| 203 |
// // FIXME: get graphics by creating an image insetad of passing the chart panel to this renderer |
|
| 204 |
//// BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB); |
|
| 205 |
//// Graphics2D graphics = img.createGraphics(); |
|
| 206 |
// // FIXME: rendering quality tests |
|
| 207 |
//// RenderingHints rh = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); |
|
| 208 |
//// rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
| 209 |
//// rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); |
|
| 210 |
//// rh.put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
|
| 211 |
//// graphics.setRenderingHints(rh); |
|
| 212 |
// |
|
| 213 |
// Font font = this.getItemLabelFont(series, item); |
|
| 214 |
// String label = valuesNumberFormat.format(dataset.getSeries(series).getY(item)) + " / " + (dataset.getSeries(series).getItemCount() - 2); //$NON-NLS-1$ // -2 for the 0 point and the dummy last point; |
|
| 215 |
// |
|
| 216 |
// GlyphVector v = font.createGlyphVector(graphics.getFontMetrics(font).getFontRenderContext(), label); |
|
| 217 |
// Shape labelShape = v.getOutline(); |
|
| 218 |
// //Rectangle2D labelBounds = v.getVisualBounds(); |
|
| 219 |
// |
|
| 220 |
// Rectangle2D labelBounds = font.getStringBounds(label, graphics.getFontRenderContext()); |
|
| 221 |
// |
|
| 222 |
// // FIXME : not rounded rectangle version |
|
| 223 |
//// Shape labelBackground = new Rectangle2D.Double(-bounds.getWidth() / 2, -s.getBounds2D().getHeight() / 2 + 1, bounds.getWidth() + 4, bounds.getHeight() / 2 + 8); |
|
| 224 |
// |
|
| 225 |
// //Rectangle2D labelBounds = font.getStringBounds(label, graphics.getFontRenderContext()); |
|
| 226 |
// |
|
| 227 |
// //Rectangle labelBounds = labelShape.getBounds(); |
|
| 228 |
// |
|
| 229 |
// //Shape labelBackground = new RoundRectangle2D.Double(-(labelBounds.getWidth() + 4) / 2, -s.getBounds2D().getHeight() / 2 + 1, labelBounds.getWidth() + 8, labelBounds.getHeight() / 2 + 10, 5, 5); |
|
| 230 |
// double width = labelBounds.getWidth() + 10; |
|
| 231 |
// double height = labelBounds.getHeight() + 10; |
|
| 232 |
// Shape labelBackground = new RoundRectangle2D.Double(-width / 2, -height / 2 - 15, width, height, 5, 5); |
|
| 233 |
// |
|
| 234 |
// AffineTransform t2 = new AffineTransform(); |
|
| 235 |
// t2.setToScale(0.9, 0.9); |
|
| 236 |
// Shape labelBackground2 = t2.createTransformedShape(labelBackground); |
|
| 237 |
// |
|
| 238 |
// |
|
| 239 |
// Area a = new Area(s); |
|
| 240 |
// a.add(new Area(labelBackground)); |
|
| 241 |
// //a.add(new Area(labelBackground2)); |
|
| 242 |
// //a.add(new Area(labelShape)); |
|
| 243 |
// |
|
| 244 |
// s = a; |
|
| 245 |
// //t.setToScale(1.5, 1.5); |
|
| 246 |
// |
|
| 247 |
// //return a; |
|
| 248 |
// |
|
| 249 |
// } |
|
| 253 | 250 |
else {
|
| 254 | 251 |
t.setToScale(1.5, 1.5); |
| 255 | 252 |
} |
| ... | ... | |
| 265 | 262 |
this.chartPanel = chartPanel; |
| 266 | 263 |
} |
| 267 | 264 |
|
| 268 |
|
|
| 265 |
|
|
| 269 | 266 |
@Override |
| 270 | 267 |
public String getSelectedItemLabelFromDataset(XYDataset dataset, int series, int item) {
|
| 271 |
|
|
| 268 |
|
|
| 272 | 269 |
// manage the first and last dummy point |
| 273 | 270 |
if(item == 0) {
|
| 274 | 271 |
item++; |
| ... | ... | |
| 276 | 273 |
else if(item == dataset.getItemCount(series) - 1) {
|
| 277 | 274 |
item--; |
| 278 | 275 |
} |
| 279 |
|
|
| 276 |
|
|
| 280 | 277 |
String label = ""; |
| 281 | 278 |
int globalPosition = (int) dataset.getXValue(series, item) + 1; |
| 282 |
|
|
| 279 |
|
|
| 283 | 280 |
try {
|
| 284 |
|
|
| 281 |
|
|
| 285 | 282 |
Property prop; |
| 286 |
|
|
| 283 |
|
|
| 287 | 284 |
// Ref |
| 288 | 285 |
prop = ((Progression)this.multipleItemsSelector.getResult()).getCorpus().getProperty("ref"); //$NON-NLS-1$
|
| 289 | 286 |
// Text id |
| 290 | 287 |
if(prop == null) {
|
| 291 | 288 |
prop = ((Progression)this.multipleItemsSelector.getResult()).getCorpus().getStructuralUnit("text").getProperty("id"); //$NON-NLS-1$ //$NON-NLS-2$
|
| 292 | 289 |
} |
| 293 |
|
|
| 290 |
|
|
| 294 | 291 |
Match selectedWordMatch = new Match(globalPosition, globalPosition); |
| 295 | 292 |
label = selectedWordMatch.getValueForProperty(prop); |
| 296 |
|
|
| 293 |
|
|
| 297 | 294 |
} |
| 298 | 295 |
catch(CqiClientException e) {
|
| 299 | 296 |
// TODO Auto-generated catch block |
| 300 | 297 |
e.printStackTrace(); |
| 301 | 298 |
} |
| 302 |
|
|
| 299 |
|
|
| 303 | 300 |
// manage the first 0 dummy point |
| 304 | 301 |
if(item == 0) {
|
| 305 | 302 |
item++; |
| 306 | 303 |
} |
| 307 |
|
|
| 304 |
|
|
| 308 | 305 |
int tokenCount = ((XYSeriesCollection)dataset).getSeries(series).getItemCount() - 2; // -2 for the 0 point and the dummy last point |
| 309 | 306 |
label += "\n" + globalPosition + " / " + RendererUtils.valuesNumberFormat.format(((XYSeriesCollection)dataset).getDomainUpperBound(false)); //$NON-NLS-1$ //$NON-NLS-2$ // -2 for the 0 point and the dummy last point |
| 310 | 307 |
|
| 311 | 308 |
label += "\n" + RendererUtils.valuesNumberFormat.format(((XYSeriesCollection) dataset).getSeries(series).getY(item)) + " / " + (((XYSeriesCollection) dataset).getSeries(series).getItemCount() - 2); //$NON-NLS-1$ //$NON-NLS-2$ // -2 for the 0 point and the dummy last point |
| 312 |
|
|
| 309 |
|
|
| 313 | 310 |
return label; |
| 314 | 311 |
} |
| 312 |
|
|
| 315 | 313 |
|
| 316 | 314 |
|
| 317 |
|
|
| 318 | 315 |
} |
| tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartsEngine.java (revision 1737) | ||
|---|---|---|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
/** |
| 102 |
* Returns a string that represents the R command to plot a grid. |
|
| 102 |
* Returns a string that represents the R command to draw a title. |
|
| 103 |
* @param title |
|
| 103 | 104 |
* @return |
| 104 | 105 |
*/ |
| 106 |
public String getTitlePlotCmd(String title) {
|
|
| 107 |
|
|
| 108 |
// FIXME: Tests |
|
| 109 |
// title(main = "Titre principal", sub = "Sous-titre", |
|
| 110 |
// xlab = "Axe des x", ylab = "Axe des y", |
|
| 111 |
// cex.main = 2, font.main= 4, col.main= "red", |
|
| 112 |
// cex.sub = 0.75, font.sub = 3, col.sub = "green", |
|
| 113 |
// col.lab ="darkblue" |
|
| 114 |
// ) |
|
| 115 |
|
|
| 116 |
return "title(main = \"" + title + "\");\n"; //$NON-NLS-1$ |
|
| 117 |
} |
|
| 118 |
|
|
| 119 |
/** |
|
| 120 |
* Returns a string that represents the R command to draw a grid. |
|
| 121 |
* @return |
|
| 122 |
*/ |
|
| 105 | 123 |
public String getGridPlotCmd() {
|
| 106 | 124 |
return "grid (NULL,NULL, lty = \"dotted\", col = \"lightgray\");\n"; //$NON-NLS-1$ |
| 107 | 125 |
} |
| 108 | 126 |
|
| 109 | 127 |
/** |
| 110 |
* Replaces or creates the vector nammed "colors" in the R workspace from the current charts engine theme palette according to specified rendering mode and items count.
|
|
| 128 |
* Replaces or creates the vector named "colors" in the R workspace from the current charts engine theme palette according to specified rendering mode and items count. |
|
| 111 | 129 |
* @param renderingColorMode |
| 112 | 130 |
* @param itemsCount |
| 113 | 131 |
*/ |
| ... | ... | |
| 116 | 134 |
} |
| 117 | 135 |
|
| 118 | 136 |
/** |
| 119 |
* Replaces or creates the vector nammed "colors" in the R workspace filled with the specified hexadecimal colors palette.
|
|
| 137 |
* Replaces or creates the vector named "colors" in the R workspace filled with the specified hexadecimal colors palette. |
|
| 120 | 138 |
* @param hexPalette |
| 121 | 139 |
*/ |
| 122 | 140 |
public void setColors(String[] hexPalette) {
|
| ... | ... | |
| 126 | 144 |
rw.addVectorToWorkspace("colors", hexPalette); //$NON-NLS-1$
|
| 127 | 145 |
} |
| 128 | 146 |
catch(RWorkspaceException e) {
|
| 129 |
// TODO Auto-generated catch block |
|
| 130 | 147 |
e.printStackTrace(); |
| 131 | 148 |
} |
| 132 | 149 |
} |
| ... | ... | |
| 136 | 153 |
public void setOutputFormat(String outputFormat) {
|
| 137 | 154 |
this.outputFormat = outputFormat; |
| 138 | 155 |
|
| 139 |
// FIXME : voir comment gérer cela autrement + supprimer certaines méthodes du RDevice devenues inutiles depuis qu'on stocke outputFormat ? |
|
| 156 |
// FIXME : SJ: voir comment gérer cela autrement + supprimer certaines méthodes du RDevice devenues inutiles depuis qu'on stocke outputFormat ?
|
|
| 140 | 157 |
if(outputFormat.equals(ChartsEngine.OUTPUT_FORMAT_JPEG)) {
|
| 141 | 158 |
this.rDevice = RDevice.JPEG; |
| 142 | 159 |
} |
| tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartCreator.java (revision 1737) | ||
|---|---|---|
| 29 | 29 |
public void updateChart(ChartResult result) {
|
| 30 | 30 |
|
| 31 | 31 |
Object chart = result.getChart(); |
| 32 |
if (chart != null && chart instanceof File) { // creates a new chart but using the same file
|
|
| 32 |
// creates a new chart using a new file |
|
| 33 |
// 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 |
if (chart != null && chart instanceof File) {
|
|
| 33 | 36 |
this.createChartFile(result, (File)chart); |
| 34 |
} else {
|
|
| 37 |
} |
|
| 38 |
// creates a new chart but using the same file |
|
| 39 |
else {
|
|
| 35 | 40 |
this.createChartFile(result); |
| 36 | 41 |
} |
| 37 | 42 |
|
| 38 | 43 |
// FIXME: using new file |
| 39 | 44 |
//this.createChartFile(resultData, preferencesNode); |
| 45 |
|
|
| 40 | 46 |
} |
| 41 | 47 |
|
| 42 | 48 |
@Override |
Formats disponibles : Unified diff