changeset 6876:a071f0a80883

FixA W/Q Diagram: Allow duplicate points. It should work but it doesn't. :-/
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 20 Aug 2013 19:50:37 +0200
parents 437856cec419
children 2d96d8240e3e
files artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/jfree/StyledXYSeries.java
diffstat 2 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Tue Aug 20 19:24:26 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java	Tue Aug 20 19:50:37 2013 +0200
@@ -314,13 +314,13 @@
             return;
         }
 
-        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc);
+        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), false, true, doc);
         List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
 
         DateFormat dateFormat = DateFormat.getDateInstance(
                 DateFormat.SHORT);
 
-        series.add(qwd.getQ(), qwd.getW());
+        series.add(qwd.getQ(), qwd.getW(), false);
 
         XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
                 dateFormat.format(qwd.getDate()),
@@ -351,7 +351,7 @@
         double[] kms = wqkms.getKms();
         for (int i = 0 ; i< kms.length; i++) {
             if (Math.abs(kms[i] - ckm) <= EPSILON) {
-                series.add(wqkms.getQ(i), wqkms.getW(i));
+                series.add(wqkms.getQ(i), wqkms.getW(i), false);
                 addAxisSeries(series, YAXIS.W.idx, visible);
                 if(visible && ThemeUtil.parseShowPointLabel(theme)) {
                     List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
@@ -598,7 +598,7 @@
             logger.debug("FixWQCurveGenerator: doWQOut: double[][]");
             double [][] data = (double [][]) wqkms;
 
-            XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+            XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), false, true, theme);
             StyledSeriesBuilder.addPoints(series, data, true);
 
             addAxisSeries(series, YAXIS.W.idx, visible);
@@ -616,7 +616,11 @@
             return;
         }
 
-        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+        XYSeries series = new StyledXYSeries(
+            aaf.getFacetDescription(),
+            false, true,
+            theme);
+
         List<XYTextAnnotation> textAnnos =
                 new ArrayList<XYTextAnnotation>(qws.length);
 
@@ -624,7 +628,7 @@
                 DateFormat.SHORT);
 
         for (QWI qw: qws) {
-            series.add(qw.getQ(), qw.getW());
+            series.add(qw.getQ(), qw.getW(), false);
 
             XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
                     dateFormat.format(qw.getDate()),
--- a/artifacts/src/main/java/org/dive4elements/river/jfree/StyledXYSeries.java	Tue Aug 20 19:24:26 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StyledXYSeries.java	Tue Aug 20 19:50:37 2013 +0200
@@ -53,6 +53,18 @@
         this.label = key.toString();
     }
 
+    public StyledXYSeries(
+        String  key,
+        boolean sorted,
+        boolean allowDuplicateXValues,
+        Document theme
+    ) {
+        super(key, sorted, allowDuplicateXValues);
+        setStyle(new XYStyle(theme));
+        this.label = key.toString();
+    }
+
+
 
     @Override
     public void setStyle(Style style) {

http://dive4elements.wald.intevation.org