Revision 382 org.gvsig.chart/trunk/org.gvsig.chart/org.gvsig.chart.app/org.gvsig.chart.app.legendplugin/src/main/java/org/gvsig/project/documents/view/legend/BarsChartLegend.java

View differences:

BarsChartLegend.java
4 4
import java.awt.Graphics2D;
5 5
import java.awt.image.BufferedImage;
6 6
import java.util.ArrayList;
7
import java.util.Arrays;
7 8
import java.util.List;
8 9
import java.util.Map;
9 10

  
......
311 312
				.getChartManager().createChartDataSet();
312 313

  
313 314
		String[] names=getFieldNames();
315

  
314 316
		if (names!=null){
315 317
			ArrayList groupedBy = new ArrayList();
316 318
			ArrayList serie = new ArrayList();
......
334 336
//			cs.createChartLegendItems();
335 337
			List<ChartSerieEntity> lst  = cs.getChartLegendItems();
336 338

  
337
			for (int j=0; j < colors.length; j++) {
338
				LegendItem item = new LegendItem(names[j], colors[j]);
339
            for (int j=0; j < names.length; j++) {
340
                colors[j] = getSymbolByValue(names[j]).getColor();
341
                LegendItem item = new LegendItem(names[j], colors[j]);
339 342
				item.setSeriesKey(names[j]);
340 343
				ChartSerieEntity e = cs.createNewChartSerieEntity(item);
341 344
				if(e!=null)
342 345
					lst.add(e);
343 346
			}
347
            cs.setCategoriesPaint(Arrays.asList(colors));
344 348
		}
345 349
		double separation = sizeTo-sizeFrom;
346 350

  
......
378 382
		}else{
379 383
			symbol.setSize(getSize());
380 384
		}
381
//		JFreeChart theChart=configureBarChart(dataSet);
382
//		symbol.setChart(theChart);
383

  
384
//		if (backgroundSymbol!=null){
385
//			multiChartSymbol multiChartSymbol=new MultiChartSymbol();
386
//			multiChartSymbol.addLayer(backgroundSymbol);
387
//			multiChartSymbol.addLayer(symbol);
388
//			return multiChartSymbol;
389
//		}
390 385
		return symbol;
391 386

  
392 387
	}
......
411 406
		updateSymbols();
412 407
	}
413 408

  
414
//	public XMLEntity getXMLEntity() {
415
//		XMLEntity xml = new XMLEntity();
416
//		xml.putProperty("className", getClass().getName());
417
//		xml.putProperty("size", getSize());
418
//		if (getClassifyingFieldNames()!=null)
419
//			xml.putProperty("classifyingFieldNames", getClassifyingFieldNames());
420
//		xml.putProperty("fieldNames", getFieldNames());
421
//		xml.putProperty("labelNames", getLabels());
422
//		ArrayList<String> stringColors=new ArrayList<String>();
423
//		for (int i = 0; i < getColors().length; i++) {
424
//			stringColors.add(StringUtilities.color2String(getColors()[i]));
425
//		}
426
//
427
//		xml.putProperty("colors",stringColors.toArray(new String[0]));
428
//		xml.putProperty("outlineShow", isOutlineShow());
429
//		xml.putProperty("outlineColor",StringUtilities.color2String(getOutlineColor()));
430
//		xml.putProperty("outlineWidth", getOutlineWidth());
431
//		xml.putProperty("is3D", is3D());
432
//		xml.putProperty("sizeOption", getSizeOption());
433
//		xml.putProperty("fieldSize", getFieldSize());
434
//		xml.putProperty("fieldNormalize", getFieldNormalize());
435
//		xml.putProperty("unit", getUnit());
436
//		xml.putProperty("referenceSystem", getReferenceSystem());
437
//		xml.putProperty("sizeFrom", getSizeFrom());
438
//		xml.putProperty("sizeTo", getSizeTo());
439
//		xml.putProperty("activeLimits", isActiveLimits());
440
//		xml.putProperty("maxFeature", getMaxFeature());
441
//		xml.putProperty("minFeature", getMinFeature());
442
//		xml.putProperty("onlySelection", isOnlySelection());
443
//		xml.putProperty("maxField", getMaxField());
444
//		if (getBackgroundSymbol()!=null)
445
//			xml.addChild(getBackgroundSymbol().getXMLEntity());
446
//		return xml;
447
//	}
448
//
449
//	public void setXMLEntity(XMLEntity xml) {
450
//		setSize(xml.getIntProperty("size"));
451
//		if (xml.contains("classifyingFieldNames"))
452
//			setClassifyingFieldNames(xml.getStringArrayProperty("classifyingFieldNames"));
453
//		setFieldNames(xml.getStringArrayProperty("fieldNames"));
454
//		if (xml.contains("labelNames")){
455
//			setLabels(xml.getStringArrayProperty("labelNames"));
456
//		}else{
457
//			setLabels(xml.getStringArrayProperty("fieldNames"));
458
//		}
459
//
460
//		String[] stringColors=xml.getStringArrayProperty("colors");
461
//		Color[] colors=new Color[stringColors.length];
462
//		for (int i = 0; i < stringColors.length; i++) {
463
//			colors[i]=StringUtilities.string2Color(stringColors[i]);
464
//		}
465
//		setColors(colors);
466
//
467
//		setOutlineShow(xml.getBooleanProperty("outlineShow"));
468
//		setOutlineColor(StringUtilities.string2Color(xml.getStringProperty("outlineColor")));
469
//		setOutlineWidth(xml.getIntProperty("outlineWidth"));
470
//		setIs3D(xml.getBooleanProperty("is3D"));
471
//		setSizeOption(xml.getIntProperty("sizeOption"));
472
//		setFieldSize(xml.getStringProperty("fieldSize"));
473
//		setFieldNormalize(xml.getStringProperty("fieldNormalize"));
474
//		setUnit(xml.getIntProperty("unit"));
475
//		setReferenceSystem(xml.getIntProperty("referenceSystem"));
476
//		setSizeFrom(xml.getIntProperty("sizeFrom"));
477
//		setSizeTo(xml.getIntProperty("sizeTo"));
478
//		setActiveLimits(xml.getBooleanProperty("activeLimits"));
479
//		setMaxFeature(xml.getDoubleProperty("maxFeature"));
480
//		setMinFeature(xml.getDoubleProperty("minFeature"));
481
//		if (xml.contains("onlySelection")){
482
//			setOnlySelection(xml.getBooleanProperty("onlySelection"));
483
//		}
484
//		if (xml.contains("maxField")){
485
//			setMaxField(xml.getDoubleProperty("maxField"));
486
//		}
487
//		if (xml.getChildrenCount()>0){
488
//			setBackgroundSymbol(SymbologyFactory.createSymbolFromXML(xml.getChild(0), null));
489
//			setDefaultSymbol(getBackgroundSymbol());
490
//		}
491
//	}
492

  
493 409
	@SuppressWarnings({ "unchecked", "rawtypes" })
494 410
	public void loadFromState(PersistentState state)
495 411
			throws PersistenceException {

Also available in: Unified diff