[Schmitzm-commits] r267 - trunk/src/schmitzm/jfree/feature/style
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sat Aug 1 14:23:05 CEST 2009
Author: mojays
Date: 2009-08-01 14:23:04 +0200 (Sat, 01 Aug 2009)
New Revision: 267
Modified:
trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
Log:
tests for changing the legend title
Modified: trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java 2009-08-01 12:09:18 UTC (rev 266)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java 2009-08-01 12:23:04 UTC (rev 267)
@@ -31,9 +31,15 @@
import org.geotools.feature.FeatureCollection;
import org.jfree.chart.JFreeChart;
+import org.jfree.chart.LegendItem;
+import org.jfree.chart.LegendItemCollection;
+import org.jfree.chart.LegendItemSource;
+import org.jfree.chart.title.LegendTitle;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.general.Dataset;
import org.jfree.data.xy.XYDataset;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
import schmitzm.jfree.chart.style.BasicChartStyle;
import schmitzm.jfree.chart.style.ChartType;
@@ -184,10 +190,37 @@
*/
@Override
public JFreeChart applyToFeatureCollection(FeatureCollection fc) {
- Dataset dataset = FeatureChartUtil.createXYDataset(
+ final XYSeriesCollection dataset = FeatureChartUtil.createXYDataset(
fc,
this
- );
- return applyToDataset(dataset);
+ );
+ JFreeChart chart = applyToDataset(dataset);
+
+// for (int i=0; i<dataset.getSeriesCount(); i++) {
+// XYSeries series = dataset.getSeries(i);
+// series.setDescription("My description for "+series.getKey());
+// }
+//
+//
+//
+// LegendTitle lt = chart.getLegend();
+// LegendItemSource[] source = lt.getSources();
+// final LegendItemSource oldSource = source[0];
+//
+// source[0] = new LegendItemSource() {
+// public LegendItemCollection getLegendItems() {
+// LegendItemCollection lic = new LegendItemCollection();
+// for (int i=0; i<dataset.getSeriesCount(); i++) {
+// XYSeries series = dataset.getSeries(i);
+// LegendItem li = new LegendItem( series.getDescription() );
+// lic.add(li);
+// }
+// // TODO Auto-generated method stub
+// return lic;
+// }
+//
+// };
+
+ return chart;
}
}
More information about the Schmitzm-commits
mailing list