annotate flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java @ 1712:7e19449d7826

#253 Modified the title creation of chart curves - titles will now equal the Facet's description. flys-artifacts/trunk@2984 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 17 Oct 2011 10:47:36 +0000
parents e99b4bd32cd5
children ffab6de07dc5
rev   line source
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.jfree.chart.JFreeChart;
1170
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
6 import org.jfree.chart.plot.XYPlot;
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import org.jfree.data.xy.XYSeries;
1653
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
8 import org.jfree.data.Range;
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 import org.w3c.dom.Document;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import de.intevation.artifacts.Artifact;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 import de.intevation.artifactdatabase.state.Facet;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.artifacts.FLYSArtifact;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 import de.intevation.flys.artifacts.model.FacetTypes;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 import de.intevation.flys.artifacts.model.WKms;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
20 import de.intevation.flys.utils.DataUtil;
1627
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
21
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
22 import de.intevation.flys.artifacts.model.WQKms;
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
23 import de.intevation.flys.utils.FLYSUtils;
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
24
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 /**
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 * An OutGenerator that generates w differences curves.
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 */
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 public class WDifferencesCurveGenerator
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 extends LongitudinalSectionGenerator
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 implements FacetTypes
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 {
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 /** The logger that is used in this generator. */
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 private static Logger logger =
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 Logger.getLogger(WDifferencesCurveGenerator.class);
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
37 /** Key for internationalized title of WDiff charts. */
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
38 public final static String I18N_WDIFF_TITLE = "chart.w_differences.title";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
39
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
40 /** Default for internationalized title (when no translation found). */
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
41 public final static String I18N_WDIFF_TITLE_DEFAULT = "Differences";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
42
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
43 /** Key for internationalized title of WDiff charts. */
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
44 public final static String I18N_WDIFF_2YAXIS_LABEL =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
45 "chart.w_differences.yaxis.second.label";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
46
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
47 /** Default for label for second Y-Axis when no translation found. */
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
48 public final static String I18N_WDIFF_2YAXIS_LABEL_DEFAULT = "W [NN + m]";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
49
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
50 public final static String I18N_WDIFF_SUBTITLE =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
51 "chart.w_differences.subtitle";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
52
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
53 public final static String I18N_WDIFF_YAXIS_LABEL =
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
54 "chart.w_differences.yaxis.label";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
55
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
56 public final static String I18N_WDIFF_YAXIS_LABEL_DEFAULT = "m";
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
57
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
59 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
60 * Get internationalized title for chart.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
61 */
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
62 public String getChartTitle() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
63 return msg(I18N_WDIFF_TITLE, I18N_WDIFF_TITLE_DEFAULT);
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
64 }
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 /**
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
68 * Get default value for the second Y-Axis' label (if no translation was
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
69 * found).
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 */
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 @Override
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
72 protected String get2YAxisDefaultLabel() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
73 return I18N_WDIFF_2YAXIS_LABEL_DEFAULT;
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
74 }
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
75
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
76
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
77 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
78 * Gets key to look up internationalized String for the charts subtitle.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
79 * @return key to look up translated subtitle.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
80 */
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
81 @Override
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
82 protected String getChartSubtitleKey() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
83 return I18N_WDIFF_SUBTITLE;
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
84 }
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
85
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
86
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
87 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
88 * Get key for internationalization of the second Y-Axis' label.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
89 */
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
90 @Override
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
91 protected String get2YAxisLabelKey() {
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
92 return I18N_WDIFF_2YAXIS_LABEL;
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
93 }
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
94
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
95
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
96 /**
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
97 * Get internationalized label for the y axis.
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
98 */
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
99 @Override
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
100 protected String getYAxisLabel() {
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
101 FLYSArtifact flys = (FLYSArtifact) master;
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
102
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
103 String unit = FLYSUtils.getRiver(flys).getWstUnit().getName();
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
104
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
105 return msg(
1701
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
106 I18N_WDIFF_YAXIS_LABEL,
6e59208839ae Expose translateable Strings as constants.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1700
diff changeset
107 I18N_WDIFF_YAXIS_LABEL_DEFAULT,
1700
13a9ee6cebef Fix most labels in w-diff diagrams; refactoring to allow easier adoption of
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1695
diff changeset
108 new Object[] { unit });
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 /**
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113 * Add (themed) data for chart generation.
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 */
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
115 @Override
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
116 public void doOut(
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
117 Artifact artifact,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
118 Facet facet,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
119 Document attr,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
120 boolean visible
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
121 ) {
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122 String name = facet.getName();
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 logger.debug("WDifferencesCurveGenerator.doOut: " + name);
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 if (name == null) {
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 logger.error("No facet name for doOut(). No output generated!");
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 return;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 FLYSArtifact flys = (FLYSArtifact) artifact;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 Facet f = flys.getNativeFacet(facet);
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 if (f == null) {
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 return;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 if (name.equals(W_DIFFERENCES)) {
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
139 doWDifferencesOut(
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
140 (WKms) f.getData(artifact, context),
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
141 facet,
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
142 attr,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
143 visible);
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 }
1627
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
145 else if (name.equals(LONGITUDINAL_W)) {
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
146 doWOut((WQKms) f.getData(artifact, context), facet, attr, visible);
1627
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
147 }
1695
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
148 else {
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 logger.warn("Unknown facet name: " + name);
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 return;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153
1170
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
154
1640
fb296bdf815f Improved w-differences diagram generation with included 'absolute' values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1627
diff changeset
155 /**
fb296bdf815f Improved w-differences diagram generation with included 'absolute' values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1627
diff changeset
156 * Add the waterlevel-curves (the "absolutes" from which
fb296bdf815f Improved w-differences diagram generation with included 'absolute' values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1627
diff changeset
157 * differences were calculated).
1695
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
158 *
1640
fb296bdf815f Improved w-differences diagram generation with included 'absolute' values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1627
diff changeset
159 * @param wqkms The wqkms to add to the diagram.
1695
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
160 * @param theme The theme that contains styling information.
1640
fb296bdf815f Improved w-differences diagram generation with included 'absolute' values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1627
diff changeset
161 */
1695
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
162 @Override
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
163 protected void doWOut(
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
164 WQKms wqkms,
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
165 Facet facet,
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
166 Document theme,
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
167 boolean visible
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
168 ) {
1695
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
169 logger.debug("WDifferencesCurveGenerator.doWOut");
1627
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
170
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
171 XYSeries series = new StyledXYSeries(facet.getDescription(), theme);
1627
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
172
1695
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
173 int size = wqkms.size();
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
174
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
175 for (int i = 0; i < size; i++) {
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
176 series.add(wqkms.getKm(i), wqkms.getW(i));
1627
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
177 }
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
178
1695
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
179 // Note: the only difference in the super-implementation
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
180 // (in LongitudinalSectionGenerator) is here (adds with
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
181 // addFirstAxisSeries() .
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
182 addSecondAxisSeries(series, visible);
1627
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
183
1695
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
184 if (needInvertAxis(wqkms)) {
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
185 setInverted(true);
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
186 }
0c9f7cc2cc11 In WDifferenceCurveGenerator use slightly modified doWOut-implementation of LongitudinalSectionGenerator.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
187 }
1640
fb296bdf815f Improved w-differences diagram generation with included 'absolute' values.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1627
diff changeset
188
1627
d1b20d0e9eb4 Let WDifferencesCurveGenerator process LONGITUDINAL_W facets.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1170
diff changeset
189
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
190 /**
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
191 * Add items to dataseries which describes the differences.
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
192 */
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
193 protected void doWDifferencesOut(
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
194 WKms wkms,
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
195 Facet facet,
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
196 Document theme,
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
197 boolean visible
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
198 ) {
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
199 logger.debug("WDifferencesCurveGenerator.doWDifferencesOut");
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
200 if (wkms == null) {
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
201 logger.warn("No data to add to WDifferencesChart.");
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
202 return;
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
203 }
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
204
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
205 int size = wkms.size();
1712
7e19449d7826 #253 Modified the title creation of chart curves - titles will now equal the Facet's description.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1708
diff changeset
206 XYSeries series = new StyledXYSeries(facet.getDescription(), theme);
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
207
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
208 if (logger.isDebugEnabled()) {
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
209 if (wkms.size() > 0) {
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
210 logger.debug("Generate series: " + series.getKey());
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
211 logger.debug("Start km: " + wkms.getKm(0));
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
212 logger.debug("End km: " + wkms.getKm(size-1));
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
213 logger.debug("Values : " + size);
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
214 }
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
215 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
216
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
217 for (int i = 0; i < size; i++) {
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
218 series.add(wkms.getKm(i), wkms.getW(i));
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
219 }
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
220
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1678
diff changeset
221 addFirstAxisSeries(series, visible);
1678
03fbf1b30e72 Removed code duplication of guessWaterIncreasing()
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1653
diff changeset
222 if (DataUtil.guessWaterIncreasing(wkms.allWs())) {
1162
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
223 setInverted(true);
588798ef4791 Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1158
diff changeset
224 }
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
225 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
226
1653
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
227 /**
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
228 * Disable Longitudinals behaviour to include "0" in the Q axis.
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
229 * @param range range with which to look up upper bound.
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
230 * @return range to be used for "auto-scaling" axis.
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
231 */
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
232 @Override
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
233 protected Range createSecondAxisRange(Range range) {
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
234 return new Range(range.getLowerBound(), range.getUpperBound());
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
235 }
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
236
1653
73794985a899 Enable auto-scaling axis for waterlevels in WDifference-plots.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1646
diff changeset
237
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
238 /**
1170
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
239 *
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
240 */
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
241 @Override
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
242 public JFreeChart generateChart() {
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
243 JFreeChart chart = super.generateChart();
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
244 if (chart != null && chart.getPlot() != null) {
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
245 XYPlot plot = (XYPlot) chart.getPlot();
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
246 plot.setRangeZeroBaselineVisible(true);
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
247 }
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
248 return chart;
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
249 }
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
250
1e1ef8b750db Partial fix flys/issue304 (3:Display ZeroBaseline).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1162
diff changeset
251 /**
1151
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
252 * Get name of series (displayed in legend).
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
253 * @return name of the series.
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
254 */
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
255 protected String getSeriesName(WKms wqkms, String mode) {
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
256 String name = wqkms.getName();
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
257 String prefix = (name != null && name.indexOf(mode) >= 0)
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
258 ? null
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
259 : mode;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
260
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
261 return (prefix != null && prefix.length() > 0)
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
262 ? prefix + "(" + name +")"
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
263 : name;
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
264 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
265 }
08048bd090e6 Added very stubby WDifferences State/OutGenerator for WINFOArtifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
266 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org