comparison 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
comparison
equal deleted inserted replaced
419:4de7d9eac10f 420:a0afdda4d4b9
1 package de.intevation.flys.exports; 1 package de.intevation.flys.exports;
2
3 import java.awt.Color;
2 4
3 import org.apache.log4j.Logger; 5 import org.apache.log4j.Logger;
4 6
7 import org.jfree.chart.JFreeChart;
8 import org.jfree.chart.plot.XYPlot;
9 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
5 import org.jfree.data.xy.XYSeries; 10 import org.jfree.data.xy.XYSeries;
11 import org.jfree.data.xy.XYSeriesCollection;
6 12
7 import org.w3c.dom.Document; 13 import org.w3c.dom.Document;
8 14
9 import de.intevation.artifacts.Artifact; 15 import de.intevation.artifacts.Artifact;
10 16
28 /** The facet for Ws.*/ 34 /** The facet for Ws.*/
29 public static final String FACET_W = "discharge_longitudinal_section.w"; 35 public static final String FACET_W = "discharge_longitudinal_section.w";
30 36
31 /** The facet for Qs.*/ 37 /** The facet for Qs.*/
32 public static final String FACET_Q = "discharge_longitudinal_section.q"; 38 public static final String FACET_Q = "discharge_longitudinal_section.q";
39
40
41 /** The storage for the corrected W series to be drawn in this chart.*/
42 protected XYSeriesCollection cw;
43
44
45 public DischargeLongitudinalSectionGenerator() {
46 super();
47
48 this.cw = new XYSeriesCollection();
49 }
50
51
52 public void addDatasets(JFreeChart chart) {
53 super.addDatasets(chart);
54
55 XYPlot plot = (XYPlot) chart.getPlot();
56
57 plot.setDataset(2, cw);
58 }
59
60
61 protected void adjustPlot(XYPlot plot) {
62 super.adjustPlot(plot);
63
64 // TODO REMOVE THIS CODE, IF WE HAVE INTRODUCED THEMES!
65 XYLineAndShapeRenderer rw = (XYLineAndShapeRenderer)
66 plot.getRendererForDataset(w);
67
68 XYLineAndShapeRenderer rcw = null;
69 try {
70 rcw = (XYLineAndShapeRenderer) rw.clone();
71 }
72 catch (Exception e) {
73 logger.error(e, e);
74 }
75
76 int cwNum = cw.getSeriesCount();
77
78 for (int i = 0; i < cwNum; i++) {
79 rcw.setSeriesPaint(i, Color.RED);
80 }
81
82 plot.setRenderer(2, rcw);
83 }
33 84
34 85
35 86
36 @Override 87 @Override
37 public void doOut(Artifact artifact, String facet, Document attr) { 88 public void doOut(Artifact artifact, String facet, Document attr) {
120 171
121 series.add(target[2], target[3]); 172 series.add(target[2], target[3]);
122 } 173 }
123 174
124 if (series.getItemCount() > 0) { 175 if (series.getItemCount() > 0) {
125 w.addSeries(series); 176 cw.addSeries(series);
126 } 177 }
127 } 178 }
128 } 179 }
129 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 180 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org