changeset 2653:fa363aac788b

Added accidentally ommitted File in last commit. flys-artifacts/trunk@4319 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 27 Apr 2012 09:58:59 +0000
parents 9d2a06c3a134
children 884ae61def58
files flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java	Fri Apr 27 09:58:21 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java	Fri Apr 27 09:58:59 2012 +0000
@@ -17,11 +17,15 @@
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.data.xy.XYDataset;
+import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
 import org.jfree.ui.RectangleEdge;
 import org.jfree.util.BooleanList;
 import org.jfree.util.ShapeUtilities;
 
+import de.intevation.flys.jfree.HasLabel;
+
+
 /**
  * Renderer with additional the additional functionality of renderering minima
  * and/or maxima of dataseries contained in datasets.
@@ -239,9 +243,10 @@
 
         // Draw label of line.
         if (isShowLineLabel(series) && isMinimumX (dataset, series, item)) {
-            String waterlevelLabel =
-                ((XYSeriesCollection) dataset).getSeries(series)
-                    .getKey().toString();
+            XYSeries xYSeries = ((XYSeriesCollection) dataset).getSeries(series);
+            String waterlevelLabel = (xYSeries instanceof HasLabel)
+                ? ((HasLabel)xYSeries).getLabel()
+                : xYSeries.getKey().toString();
             // TODO Force water of some German rivers to flow direction mountains.
             g2.drawString(waterlevelLabel, (float)xx, (float)yy-3f);
         }

http://dive4elements.wald.intevation.org