Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionGenerator.java @ 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 | 1ed48e2ddc1b |
children | c8bb38115290 |
line wrap: on
line diff
--- 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); } } }