[Dive4elements-commits] [PATCH 2 of 3] Do not autozoom on logarithmic axis. Autozoom tries to include 0 in most cases

Wald Commits scm-commit at wald.intevation.org
Fri Apr 12 12:25:10 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1365762121 -7200
# Node ID c2a590925ec307facb7df3424d135032348c22bc
# Parent  17c956be4692d58c17d15e43b5f788a985c42176
Do not autozoom on logarithmic axis. Autozoom tries to include 0 in most cases
Part of a Fix for issue/12345

diff -r 17c956be4692 -r c2a590925ec3 flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
--- 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);
 


More information about the Dive4elements-commits mailing list