Revision 643

tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 643)
130 130
		this.resultArea.dispose();
131 131
		
132 132
		// Chart composite
133
		this.chartComposite = this.getSWTChartsComponentsProvider().createComposite(this, parent);
133
		this.chartComposite = SWTChartsComponentsProvider.getComponentsProvider(this.getResult().getChartsEngine()).createComposite(this, parent);
134 134
		
135 135
		GridData gd = new GridData(GridData.FILL_BOTH);
136 136
//		gd.grabExcessVerticalSpace = true;
......
209 209
		// check that the charts engine used for the result matches the SWT components provider otherwise fin a suitable components provider
210 210
		if(this.getResult().getChartsEngine() != this.getSWTChartsComponentsProvider().getChartsEngine())	{
211 211
			this.getEditorInput().setSWTChartsComponentsProvider(SWTChartsComponentsProvider.getComponentsProvider(this.getResult().getChartsEngine()));
212
			this.getSWTChartsComponentsProvider().setChartsEngine(this.getResult().getChartsEngine());
213 212
			System.err.println("ChartEditor.__updateEditorFromResult(): charts engine used to create the chart is not the current one. The SWT components provider has been changed to match it: " + this.getSWTChartsComponentsProvider() + ".");
214 213
			
215 214
			// recreating the chart composite
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 643)
164 164
		}
165 165

  
166 166
		
167
		ChartCreator chartCreator = ChartsEngine.getCurrent().getChartCreator(this);
167
		ChartCreator chartCreator = this.chartsEngine.getChartCreator(this);
168 168
		
169 169
		// try to find a chart creator in other charts engines
170 170
		if(chartCreator == null)	{
......
175 175
				chartCreator = ChartsEngine.getChartsEngines().get(i).getChartCreator(this);
176 176
				if(chartCreator != null)	{
177 177
					System.out.println("ChartResult.renderChart(): another suitable chart creator has been found in charts engine: " + ChartsEngine.getChartsEngines().get(i) + ".");
178
					this.chartsEngine = ChartsEngine.getChartsEngines().get(i);
178 179
					break;
179 180
				}
180 181
			}
......
245 246
	 * Dedicated to force a chart recreation, eg. for cloning the chart result or for dynamically changing the chart type .
246 247
	 * @throws Exception
247 248
	 */
248
	protected void clearLastRenderingParameters() {
249
	public void clearLastRenderingParameters() {
249 250
		this.clearLastParameters(Parameter.RENDERING);
250 251
	}
251 252
	
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java (revision 643)
293 293
		if(chart != null)	{
294 294
			// creates components if they not exist
295 295
			if(this.chartComponent == null)	{
296

  
297
				// recreates the chart if not of right type
298
				if(!(chart instanceof JFreeChart))	{
299
					try {
300
						this.chartEditor.getResult().clearLastRenderingParameters();
301
						this.chartEditor.getResult().compute();
302
					}
303
					catch (Exception e) {
304
						// TODO Auto-generated catch block
305
						e.printStackTrace();
306
					}
307
				}
296 308
				
297 309
				this.chartEditor.getSWTChartsComponentsProvider().createChartContainer(this.chartEditor.getEditorInput());
298 310
				this.chartComponent = (IChartComponent) this.chartEditor.getEditorInput().getChartContainer();
......
304 316

  
305 317
			// recreates the chart if not of right type
306 318
			// FIXME: does not work? step to reproduce : create a chart with R/SVG, close the editor, select JFC/Java2d as chart engine, double click on the result 
307
			if(!(chart instanceof JFreeChart))	{
308
				this.loadChart(this.chartEditor.getSWTChartsComponentsProvider().getChartsEngine().getChartCreator(this.chartEditor.getResult()).createChart(this.chartEditor.getResult()));
309
			}
310
			else	{
319
//			if(!(chart instanceof JFreeChart))	{
320
//				this.loadChart(this.chartEditor.getSWTChartsComponentsProvider().getChartsEngine().getChartCreator(this.chartEditor.getResult()).createChart(this.chartEditor.getResult()));
321
//			}
322
//			else	{
311 323
				this.loadChart(this.chartEditor.getChart());
312
			}
324
//			}
313 325
			
314 326
			this.forceFocus();
315 327
		}
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsPieChartCreator.java (revision 643)
61 61
				title = Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle);
62 62
			}
63 63
			
64
			// colors
65
			//this.getChartsEngine().setColors(result.getRenderingColorsMode(),  1);
66
			// FIXME: one color by part
67
			this.getChartsEngine().setColors(result.getRenderingColorsMode(),  parts.size());
68

  
69
			
64 70
			String ylab = PartitionCoreMessages.CHARTSENGINE_PARTITION_DIMENSIONS_Y_AXIS_LABEL;
65 71

  
66
			String cmd = "pie(" + ssizes + ", labels=" + snames + //$NON-NLS-1$ //$NON-NLS-2$
72
			String cmd = "pie(" + ssizes + ", col=colors, labels=" + snames + //$NON-NLS-1$ //$NON-NLS-2$
67 73
					", main=\"" + title + "\", horiz=F, las=2, ylab=\"" + ylab + "\")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
68 74

  
69 75
			

Also available in: Unified diff