Revision 171

tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/renderers/MultipleItemsSelector.java (revision 171)
17 17
import org.jfree.chart.plot.CategoryPlot;
18 18
import org.jfree.chart.plot.XYPlot;
19 19
import org.jfree.data.xy.XYDataset;
20
//import org.txm.ca.core.chartsengine.jfreechart.datasets.FCAXYDataset;
20
import org.txm.ca.core.chartsengine.jfreechart.datasets.FCAXYDataset;
21 21
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IItemSelectionRenderer;
22 22

  
23 23
/**
......
302 302
				// Test FCAXYDataset
303 303
				
304 304
				// FIXME: tests, navigation clavier par ordre alphabétique d'une AFC (toute séries confondues)
305
//				String label = ((FCAXYDataset)dataset).getLabel(i,  j);
306
//				allFlattenValues.put(label, itemData);
305
				String label = ((FCAXYDataset)dataset).getLabel(i,  j);
306
				allFlattenValues.put(label, itemData);
307 307
				
308 308
				// FIXME: tests, navigation clavier par coord X d'une AFC (toute séries confondues)
309 309
				//allFlattenValues.put(dataset.getX(i, j), itemData);
......
342 342
	}
343 343
	
344 344

  
345
	
346
	/**
347
	 * Gets a map where the values of the dataset are ordered according to the specified label arrays, keeping the order of these arrays and flatten but grouped by series.
348
	 * @param dataset
349
	 * @return
350
	 */
351
	public TreeMap<Object, ArrayList<Integer>> getItemsAndSeriesOrderedByLabels(FCAXYDataset dataset, String[] rowLabels, String[] colLabels)	{
352
		
353
		TreeMap<Object, ArrayList<Integer>> orderedValues = new TreeMap<Object, ArrayList<Integer>>();
354
		
355
		int[] rowIndices = dataset.getOrderedLabelIndices(0, rowLabels);
356
		int[] colIndices = dataset.getOrderedLabelIndices(1, colLabels);
357
		
358
		int i = 0;
359
		for(; i < rowIndices.length; i++) {
360
			ArrayList<Integer> itemData = new ArrayList<Integer>(2);
361
			itemData.add(0); // series
362
			itemData.add(rowIndices[i]); // item
363
			orderedValues.put(i, itemData);
364
		}
365
		for(int j = 0; j < colIndices.length; j++) {
366
			ArrayList<Integer> itemData = new ArrayList<Integer>(2);
367
			itemData.add(1); // series
368
			itemData.add(colIndices[j]); // item
369
			orderedValues.put(j + i, itemData);
370
		}
371
	
372
		return orderedValues;
373
	}
345 374

  
346
//	/**
347
//	 * Gets a map where the values of the dataset are ordered according to the specified label arrays, keeping the order of these arrays and flatten but grouped by series.
348
//	 * @param dataset
349
//	 * @return
350
//	 */
351
//	public TreeMap<Object, ArrayList<Integer>> getItemsAndSeriesOrderedByLabels(XYDataset dataset, String[] rowLabels, String[] colLabels)	{
352
//		
353
//		TreeMap<Object, ArrayList<Integer>> orderedValues = new TreeMap<Object, ArrayList<Integer>>();
354
//		
355
//		int[] rowIndices = dataset.getOrderedLabelIndices(0, rowLabels);
356
//		int[] colIndices = dataset.getOrderedLabelIndices(1, colLabels);
357
//		
358
//		int i = 0;
359
//		for(; i < rowIndices.length; i++) {
360
//			ArrayList<Integer> itemData = new ArrayList<Integer>(2);
361
//			itemData.add(0); // series
362
//			itemData.add(rowIndices[i]); // item
363
//			orderedValues.put(i, itemData);
364
//		}
365
//		for(int j = 0; j < colIndices.length; j++) {
366
//			ArrayList<Integer> itemData = new ArrayList<Integer>(2);
367
//			itemData.add(1); // series
368
//			itemData.add(colIndices[j]); // item
369
//			orderedValues.put(j + i, itemData);
370
//		}
371
//	
372
//		return orderedValues;
373
//	}
374

  
375 375
	
376 376
	/**
377 377
	 * Gets a map where the values of the dataset are orderer by label and flatten but grouped by series.
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/renderers/interfaces/IItemSelectionRenderer.java (revision 171)
2 2

  
3 3
import java.awt.Paint;
4 4

  
5
import org.jfree.chart.ChartPanel;
5 6
import org.jfree.chart.event.RendererChangeEvent;
6 7
import org.jfree.chart.plot.CategoryPlot;
7 8
import org.jfree.chart.plot.Plot;
8
import org.txm.chartsengine.core.___ChartsEngine;
9 9
import org.txm.chartsengine.jfreechart.core.renderers.MouseOverItemSelector;
10
import org.txm.core.chartsengine.base.___ChartsEngine;
10 11

  
11 12

  
12 13
/**
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/renderers/MouseOverItemSelector.java (revision 171)
9 9
import org.jfree.chart.event.RendererChangeEvent;
10 10
import org.jfree.chart.plot.SeriesRenderingOrder;
11 11
import org.jfree.chart.plot.XYPlot;
12
//import org.txm.ca.core.chartsengine.jfreechart.themes.highcharts.renderers.FCAItemSelectionRenderer;
12
import org.txm.ca.core.chartsengine.jfreechart.themes.highcharts.renderers.FCAItemSelectionRenderer;
13 13
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IItemSelectionRenderer;
14 14
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYLineAndShapeRenderer;
15 15

  
......
291 291
		return item;
292 292
	}
293 293
	
294
//	/**
295
//	 * Changes the CA plot series rendering order according the selected series in item selector.
296
//	 * @param renderer
297
//	 */
298
//	public void setItemDrawnAtLast(FCAItemSelectionRenderer renderer)	{
299
//		
300
//		if(this.mouseOverSeries != -1) {
301
//			
302
//			XYPlot plot = (XYPlot) this.renderer.getPlot();
303
//			
304
//			// FIXME: it swaps only between rows and cols order but we may manage order of item inside same series
305
//			// Changing the rendering order
306
//			if(this.mouseOverSeries == 0)	{
307
//				// Row
308
//				plot.setSeriesRenderingOrder(SeriesRenderingOrder.REVERSE);
309
//			}
310
//			else	{
311
//				// Col
312
//				plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);
313
//			}
294
	/**
295
	 * Changes the CA plot series rendering order according the selected series in item selector.
296
	 * @param renderer
297
	 */
298
	public void setItemDrawnAtLast(FCAItemSelectionRenderer renderer)	{
299
		
300
		if(this.mouseOverSeries != -1) {
301
			
302
			XYPlot plot = (XYPlot) this.renderer.getPlot();
303
			
304
			// FIXME: it swaps only between rows and cols order but we may manage order of item inside same series
305
			// Changing the rendering order
306
			if(this.mouseOverSeries == 0)	{
307
				// Row
308
				plot.setSeriesRenderingOrder(SeriesRenderingOrder.REVERSE);
309
			}
310
			else	{
311
				// Col
312
				plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);
313
			}
314

  
315
			
316
			
317
//			// FIXME : test de tracé d'un background pour les labels des points en passant par une annotation
318
			// exemple de tracé
319
//			this.getPlot().addAnnotation(new XYAnnotation() {
314 320
//
315
//			
316
//			
317
////			// FIXME : test de tracé d'un background pour les labels des points en passant par une annotation
318
//			// exemple de tracé
319
////			this.getPlot().addAnnotation(new XYAnnotation() {
320
////
321
////				@Override
322
////				public void removeChangeListener(AnnotationChangeListener listener) {
323
////					// TODO Auto-generated method stub
324
////
325
////				}
326
////
327
////				@Override
328
////				public void addChangeListener(AnnotationChangeListener listener) {
329
////					// TODO Auto-generated method stub
330
////
331
////				}
332
////
333
////				@Override
334
////				public void draw(Graphics2D g2, XYPlot plot,
335
////						Rectangle2D dataArea, ValueAxis domainAxis,
336
////						ValueAxis rangeAxis, int rendererIndex,
337
////						PlotRenderingInfo info) {
338
////					g2.setColor(Color.red);
339
////					g2.fillRect(itemSelector.getXCoord(), itemSelector.getYCoord(), 50, 20);
340
////
341
////				}
342
////			});
343
//		}
344
//		
345
//	}
321
//				@Override
322
//				public void removeChangeListener(AnnotationChangeListener listener) {
323
//					// TODO Auto-generated method stub
324
//
325
//				}
326
//
327
//				@Override
328
//				public void addChangeListener(AnnotationChangeListener listener) {
329
//					// TODO Auto-generated method stub
330
//
331
//				}
332
//
333
//				@Override
334
//				public void draw(Graphics2D g2, XYPlot plot,
335
//						Rectangle2D dataArea, ValueAxis domainAxis,
336
//						ValueAxis rangeAxis, int rendererIndex,
337
//						PlotRenderingInfo info) {
338
//					g2.setColor(Color.red);
339
//					g2.fillRect(itemSelector.getXCoord(), itemSelector.getYCoord(), 50, 20);
340
//
341
//				}
342
//			});
343
		}
344
		
345
	}
346 346

  
347 347
	
348 348
	public void setItemDrawnAtLast(ItemSelectionXYLineAndShapeRenderer itemSelectionXYLineAndShapeRenderer) {

Also available in: Unified diff