changeset 420:a0afdda4d4b9

ISSUE-47 Adjusted the line color of W, Q and corrected W curves (temporarilly). flys-artifacts/trunk@1891 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 10 May 2011 17:57:56 +0000
parents 4de7d9eac10f
children 24b53f9aa9dc
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java
diffstat 4 files changed, 130 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 10 17:12:15 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue May 10 17:57:56 2011 +0000
@@ -1,3 +1,13 @@
+2011-05-10  Ingo Weinzierl <ingo@intevation.de>
+
+	  ISSUE-47
+
+	* src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java,
+	  src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java,
+	  src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
+	  Adjusted temporarily the color of the W, Q and corrected W curves to
+	  distinguish each other.
+
 2011-05-10  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java	Tue May 10 17:12:15 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java	Tue May 10 17:57:56 2011 +0000
@@ -1,8 +1,14 @@
 package de.intevation.flys.exports;
 
+import java.awt.Color;
+
 import org.apache.log4j.Logger;
 
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
 
 import org.w3c.dom.Document;
 
@@ -32,6 +38,51 @@
     public static final String FACET_Q = "discharge_longitudinal_section.q";
 
 
+    /** The storage for the corrected W series to be drawn in this chart.*/
+    protected XYSeriesCollection cw;
+
+
+    public DischargeLongitudinalSectionGenerator() {
+        super();
+
+        this.cw = new XYSeriesCollection();
+    }
+
+
+    public void addDatasets(JFreeChart chart) {
+        super.addDatasets(chart);
+
+        XYPlot plot = (XYPlot) chart.getPlot();
+
+        plot.setDataset(2, cw);
+    }
+
+
+    protected void adjustPlot(XYPlot plot) {
+        super.adjustPlot(plot);
+
+        // TODO REMOVE THIS CODE, IF WE HAVE INTRODUCED THEMES!
+        XYLineAndShapeRenderer rw = (XYLineAndShapeRenderer)
+            plot.getRendererForDataset(w);
+
+        XYLineAndShapeRenderer rcw = null;
+        try {
+            rcw = (XYLineAndShapeRenderer) rw.clone();
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+        }
+
+        int cwNum = cw.getSeriesCount();
+
+        for (int i = 0; i < cwNum; i++) {
+            rcw.setSeriesPaint(i, Color.RED);
+        }
+
+        plot.setRenderer(2, rcw);
+    }
+
+
 
     @Override
     public void doOut(Artifact artifact, String facet, Document attr) {
@@ -122,7 +173,7 @@
         }
 
         if (series.getItemCount() > 0) {
-            w.addSeries(series);
+            cw.addSeries(series);
         }
     }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java	Tue May 10 17:12:15 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java	Tue May 10 17:57:56 2011 +0000
@@ -1,5 +1,7 @@
 package de.intevation.flys.exports;
 
+import java.awt.Color;
+
 import org.w3c.dom.Document;
 
 import org.apache.log4j.Logger;
@@ -7,6 +9,7 @@
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
@@ -107,6 +110,37 @@
     }
 
 
+    protected void adjustPlot(XYPlot plot) {
+        super.adjustPlot(plot);
+
+        // TODO REMOVE THIS CODE, IF WE HAVE INTRODUCED THEMES!
+        XYLineAndShapeRenderer rw = (XYLineAndShapeRenderer)
+            plot.getRendererForDataset(w);
+
+        XYLineAndShapeRenderer rq = null;
+        try {
+            rq = (XYLineAndShapeRenderer) rw.clone();
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+        }
+
+        int wNum = w.getSeriesCount();
+        int qNum = q.getSeriesCount();
+
+        for (int i = 0; i < wNum; i++) {
+            rw.setSeriesPaint(i, Color.BLUE);
+        }
+
+        for (int i = 0; i < qNum; i++) {
+            rq.setSeriesPaint(i, Color.GREEN);
+        }
+
+        plot.setRenderer(0, rw);
+        plot.setRenderer(1, rq);
+    }
+
+
     protected void adjustAxes(XYPlot plot) {
         super.adjustAxes(plot);
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Tue May 10 17:12:15 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Tue May 10 17:57:56 2011 +0000
@@ -1,10 +1,13 @@
 package de.intevation.flys.exports;
 
+import java.awt.Color;
+
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
@@ -108,6 +111,37 @@
     }
 
 
+    protected void adjustPlot(XYPlot plot) {
+        super.adjustPlot(plot);
+
+        // TODO REMOVE THIS CODE, IF WE HAVE INTRODUCED THEMES!
+        XYLineAndShapeRenderer rw = (XYLineAndShapeRenderer)
+            plot.getRendererForDataset(w);
+
+        XYLineAndShapeRenderer rq = null;
+        try {
+            rq = (XYLineAndShapeRenderer) rw.clone();
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+        }
+
+        int wNum = w.getSeriesCount();
+        int qNum = q.getSeriesCount();
+
+        for (int i = 0; i < wNum; i++) {
+            rw.setSeriesPaint(i, Color.BLUE);
+        }
+
+        for (int i = 0; i < qNum; i++) {
+            rq.setSeriesPaint(i, Color.GREEN);
+        }
+
+        plot.setRenderer(0, rw);
+        plot.setRenderer(1, rq);
+    }
+
+
     protected void adjustAxes(XYPlot plot) {
         super.adjustAxes(plot);
 

http://dive4elements.wald.intevation.org