changeset 2603:664f97b6d48f

Applied patch from flys/issue639 flys-artifacts/trunk@4180 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 23 Mar 2012 09:25:54 +0000
parents 538820485945
children 83c117b639f9
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java
diffstat 2 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Mar 22 15:02:07 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Mar 23 09:25:54 2012 +0000
@@ -1,3 +1,10 @@
+2012-03-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	  flys/issue639: Bezugsliniendiagramm,Achsen-Intervall-Skalierung vereinheitlichen
+
+	* src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java:
+	  Render only axis ticks in meters.
+
 2012-03-22	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* doc/conf/themes.xml: Let hyks have a text orientation in themes.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Thu Mar 22 15:02:07 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java	Fri Mar 23 09:25:54 2012 +0000
@@ -5,11 +5,16 @@
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.NumberAxis;
+
 import org.jfree.chart.title.TextTitle;
 
 import org.jfree.data.xy.XYSeries;
 
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.NumberTickUnit;
+import org.jfree.chart.axis.TickUnits;
+
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 
 import de.intevation.flys.artifacts.model.FacetTypes;
@@ -19,6 +24,7 @@
 
 import de.intevation.flys.jfree.StyledXYSeries;
 
+import de.intevation.flys.utils.Formatter;
 
 /**
  * An OutGenerator that generates reference curves.
@@ -200,6 +206,25 @@
         addAxisSeries(series, YAXIS.W.idx, visible);
     }
 
+    protected void setAxisTickUnit(ValueAxis axis) {
+        TickUnits units = new TickUnits();
+        units.add(new NumberTickUnit(1d, Formatter.getWaterlevelW(context)));
+        axis.setStandardTickUnits(units);
+        axis.setAutoTickUnitSelection(true);
+    }
+
+    @Override
+    protected void localizeDomainAxis(ValueAxis domainAxis) {
+        super.localizeDomainAxis(domainAxis);
+        setAxisTickUnit(domainAxis);
+    }
+
+
+    @Override
+    protected void localizeRangeAxis(ValueAxis rangeAxis) {
+        super.localizeRangeAxis(rangeAxis);
+        setAxisTickUnit(rangeAxis);
+    }
 
     /** Get Walker to iterate over all axes. */
     @Override

http://dive4elements.wald.intevation.org