changeset 5672:c2a590925ec3

Do not autozoom on logarithmic axis. Autozoom tries to include 0 in most cases Part of a Fix for issue/12345
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 12 Apr 2013 12:22:01 +0200
parents 17c956be4692
children e1ba8273df07
files flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Wed Apr 10 14:48:00 2013 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Apr 12 12:22:01 2013 +0200
@@ -19,6 +19,7 @@
 import org.jfree.chart.annotations.XYTextAnnotation;
 import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.axis.LogarithmicAxis;
 import org.jfree.chart.plot.Marker;
 import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.chart.plot.XYPlot;
@@ -214,7 +215,8 @@
             false);
 
         XYPlot plot = (XYPlot) chart.getPlot();
-        plot.setDomainAxis(createXAxis(getXAxisLabel()));
+        ValueAxis axis = createXAxis(getXAxisLabel());
+        plot.setDomainAxis(axis);
 
         chart.setBackgroundPaint(Color.WHITE);
         plot.setBackgroundPaint(Color.WHITE);
@@ -236,7 +238,14 @@
 
         localizeAxes(plot);
         adjustAxes(plot);
-        autoZoom(plot);
+        if (!(axis instanceof LogarithmicAxis)) {
+            // XXX:
+            // The auto zoom without a range tries
+            // to include 0 in a logarithmic axis
+            // which triggers a bug in jfreechart that causes
+            // the values to be drawn carthesian
+            autoZoom(plot);
+        }
 
         //debugAxis(plot);
 

http://dive4elements.wald.intevation.org