diff flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java @ 1684:bdb05dc9b763

Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained. flys-artifacts/trunk@2902 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 07 Oct 2011 10:51:09 +0000
parents fbe18ad4caff
children 0053a4529f2f
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Fri Oct 07 09:40:15 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Fri Oct 07 10:51:09 2011 +0000
@@ -4,10 +4,8 @@
 
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.title.TextTitle;
-import org.jfree.data.Range;
 import org.jfree.data.xy.XYSeries;
 
 import org.w3c.dom.Document;
@@ -127,23 +125,14 @@
 
 
     /**
-     * Overrides XYChartGenerators.zoomY() to include the 0 value on the Q axis.
-     */
-    @Override
-    protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) {
-        if (plot.getRangeAxisIndex(axis) == 1) {
-            // we want the Q axis to start at 0 if no zooming has been done
-            range = new Range(0d, range.getUpperBound());
-        }
-
-        return super.zoomY(plot, axis, range, x);
-    }
-
-
-    /**
      * Let one facet do its job.
      */
-    public void doOut(Artifact artifact, Facet facet, Document attr) {
+    public void doOut(
+        Artifact artifact,
+        Facet    facet,
+        Document attr,
+        boolean  visible
+    ) {
         String name = facet.getName();
 
         logger.debug("CrossSectionGenerator.doOut: " + name);
@@ -161,10 +150,18 @@
         }
 
         if (name.equals(CROSS_SECTION)) {
-            doCrossSectionOut(f.getData(artifact, context), f.getDescription(), attr);
+            doCrossSectionOut(
+                f.getData(artifact, context),
+                f.getDescription(),
+                attr,
+                visible);
         }
         else if (name.equals(CROSS_SECTION_WATER_LINE)) {
-            doCrossSectionWaterLineOut(f.getData(artifact, context), f.getDescription(), attr);
+            doCrossSectionWaterLineOut(
+                f.getData(artifact, context),
+                f.getDescription(),
+                attr,
+                visible);
         }
         else {
             logger.warn("CrossSection.doOut: Unknown facet name: " + name);
@@ -179,7 +176,12 @@
      * @param seriesName name of the data (line) to display in legend.
      * @param theme Theme for the data series.
      */
-    protected void doCrossSectionWaterLineOut(Object o, String seriesName, Document theme) {
+    protected void doCrossSectionWaterLineOut(
+        Object     o,
+        String     seriesName,
+        Document   theme,
+        boolean    visible
+    ) {
         logger.debug("CrossSectionGenerator.doCrossSectionWaterLineOut");
 
         XYSeries series = new StyledXYSeries(seriesName, theme);
@@ -189,7 +191,7 @@
         for (int i = 0; i < pxs.length; i++) {
             series.add (a[0][i], a[1][i]);
         }
-        addFirstAxisSeries(series);
+        addFirstAxisSeries(series, visible);
     }
 
 
@@ -199,7 +201,12 @@
      * @param seriesName name of the data (line) to display in legend.
      * @param theme Theme for the data series.
      */
-    protected void doCrossSectionOut(Object o, String seriesName, Document theme) {
+    protected void doCrossSectionOut(
+        Object     o,
+        String     seriesName,
+        Document   theme,
+        boolean    visible
+    ) {
         logger.debug("CrossSectionGenerator.doCrossSectionOut");
 
         XYSeries series = new StyledXYSeries(seriesName, theme);
@@ -209,7 +216,7 @@
         for (int i = 0; i < pxs.length; i++) {
             series.add (a[0][i], a[1][i]);
         }
-        addFirstAxisSeries(series);
+        addFirstAxisSeries(series, visible);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org