changeset 3130:0dd569e9b9f1

Added new methods to add domain and value axis markers to time series plots. flys-artifacts/trunk@4731 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 20 Jun 2012 15:33:32 +0000
parents 04952869e4fa
children bac0b2721451
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java
diffstat 2 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Jun 20 15:30:38 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Jun 20 15:33:32 2012 +0000
@@ -1,3 +1,8 @@
+2012-06-20  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java:
+	  New methods to add domain and value axis markers to the plot.
+
 2012-06-20  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/DeltaWtExporter.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java	Wed Jun 20 15:30:38 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java	Wed Jun 20 15:33:32 2012 +0000
@@ -25,6 +25,9 @@
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.annotations.XYTextAnnotation;
 import org.jfree.chart.LegendItemCollection;
+import org.jfree.chart.plot.Marker;
+import org.jfree.chart.plot.ValueMarker;
+import org.jfree.ui.Layer;
 
 import org.jfree.data.Range;
 import org.jfree.data.time.TimeSeriesCollection;
@@ -32,6 +35,7 @@
 import org.jfree.data.xy.XYDataset;
 import org.jfree.data.time.Day;
 import org.jfree.data.time.TimeSeries;
+import org.jfree.data.time.RegularTimePeriod;
 
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
@@ -64,7 +68,6 @@
 
         protected int plotAxisIndex;
 
-
         public TimeseriesAxisDataset(int axisSymbol) {
             this.axisSymbol = axisSymbol;
             this.datasets   = new ArrayList<TimeSeriesCollection>();
@@ -145,6 +148,11 @@
     /** List of annotations to insert in plot. */
     protected List<FLYSAnnotation> annotations;
 
+    protected List<Marker> domainMarker;
+
+    protected List<Marker> valueMarker;
+
+    protected boolean domainZeroLineVisible;
 
     private static final Logger logger =
         Logger.getLogger(TimeseriesChartGenerator.class);
@@ -167,6 +175,8 @@
 
         xBounds = new HashMap<Integer, Bounds>();
         yBounds = new HashMap<Integer, Bounds>();
+        domainMarker = new ArrayList<Marker>();
+        valueMarker = new ArrayList<Marker>();
     }
 
 
@@ -193,11 +203,11 @@
         adjustPlot(plot);
         addDatasets(plot);
         adjustAxes(plot);
-
+        addDomainAxisMarker(plot);
+        addValueAxisMarker(plot);
         adaptZoom(plot);
 
         addAnnotationsToRenderer(plot);
-
         return chart;
     }
 
@@ -648,6 +658,22 @@
         }
     }
 
+    public void addDomainAxisMarker(XYPlot plot) {
+        logger.debug("domainmarkers: " + domainMarker.size());
+        for (Marker marker: domainMarker) {
+            logger.debug("adding domain marker");
+            plot.addDomainMarker(marker, Layer.BACKGROUND);
+        }
+        domainMarker.clear();
+    }
+
+    public void addValueAxisMarker(XYPlot plot) {
+        for (Marker marker: valueMarker) {
+            logger.debug("adding value marker..");
+            plot.addRangeMarker(marker, Layer.BACKGROUND);
+        }
+        valueMarker.clear();
+    }
 
     /** Two Ranges that span a rectangular area. */
     public static class Area {

http://dive4elements.wald.intevation.org