comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 375:60f63539d004

Ws and Qs of a longitudinal section chart are mapped to an own range axis now. flys-artifacts/trunk@1785 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 02 May 2011 09:41:22 +0000
parents 2ce7b473620e
children e07d1c3f7667
comparison
equal deleted inserted replaced
374:91fbaa2744bf 375:60f63539d004
1 package de.intevation.flys.exports; 1 package de.intevation.flys.exports;
2 2
3 import org.apache.log4j.Logger; 3 import org.apache.log4j.Logger;
4 4
5 import org.jfree.data.xy.XYDataset; 5 import org.jfree.chart.JFreeChart;
6 import org.jfree.chart.axis.NumberAxis;
7 import org.jfree.chart.plot.XYPlot;
6 import org.jfree.data.xy.XYSeries; 8 import org.jfree.data.xy.XYSeries;
7 import org.jfree.data.xy.XYSeriesCollection; 9 import org.jfree.data.xy.XYSeriesCollection;
8 10
9 import org.w3c.dom.Document; 11 import org.w3c.dom.Document;
10 12
31 33
32 public static final String LONGITUDINAL_SECTION_Q = 34 public static final String LONGITUDINAL_SECTION_Q =
33 "longitudinal_section.q"; 35 "longitudinal_section.q";
34 36
35 37
36 /** The storage for the series to be drawn in this chart.*/ 38 /** The storage for the W series to be drawn in this chart.*/
37 protected XYSeriesCollection dataset; 39 protected XYSeriesCollection w;
40
41 /** The storage for the Q series to be drawn in this chart.*/
42 protected XYSeriesCollection q;
38 43
39 44
40 public LongitudinalSectionGenerator() { 45 public LongitudinalSectionGenerator() {
41 super(); 46 super();
42 47
43 this.dataset = new XYSeriesCollection(); 48 this.w = new XYSeriesCollection();
49 this.q = new XYSeriesCollection();
44 } 50 }
45 51
46 52
47 protected String getChartTitle() { 53 protected String getChartTitle() {
48 // TODO i18n 54 // TODO i18n
58 protected String getYAxisLabel() { 64 protected String getYAxisLabel() {
59 return "W [NN + m]"; 65 return "W [NN + m]";
60 } 66 }
61 67
62 68
63 protected XYDataset getXYDataset() { 69 protected void addDatasets(JFreeChart chart) {
64 return dataset; 70 XYPlot plot = (XYPlot) chart.getPlot();
71
72 plot.setDataset(0, w);
73 plot.setDataset(1, q);
74 }
75
76
77 protected void adjustAxes(XYPlot plot) {
78 super.adjustAxes(plot);
79
80 NumberAxis qAxis = new NumberAxis("Q [m³/s]");
81
82 plot.setRangeAxis(2, qAxis);
83 plot.mapDatasetToRangeAxis(1, 2);
65 } 84 }
66 85
67 86
68 public void doOut(Artifact artifact, String facet, Document attr) { 87 public void doOut(Artifact artifact, String facet, Document attr) {
69 logger.debug("LongitudinalSectionGenerator.doOut: " + facet); 88 logger.debug("LongitudinalSectionGenerator.doOut: " + facet);
131 150
132 logger.debug("++ W Tuple: " + target[2] + " -> " + target[0]); 151 logger.debug("++ W Tuple: " + target[2] + " -> " + target[0]);
133 series.add(target[2], target[0]); 152 series.add(target[2], target[0]);
134 } 153 }
135 154
136 dataset.addSeries(series); 155 w.addSeries(series);
137 } 156 }
138 } 157 }
139 158
140 159
141 /** 160 /**
166 185
167 logger.debug("++ Q Tuple: " + target[2] + " -> " + target[1]); 186 logger.debug("++ Q Tuple: " + target[2] + " -> " + target[1]);
168 series.add(target[2], target[1]); 187 series.add(target[2], target[1]);
169 } 188 }
170 189
171 dataset.addSeries(series); 190 q.addSeries(series);
172 } 191 }
173 } 192 }
174 193
175 194
176 protected String getSeriesName(WQKms wqkms, String prefix, int idx) { 195 protected String getSeriesName(WQKms wqkms, String prefix, int idx) {

http://dive4elements.wald.intevation.org