annotate flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java @ 2691:a7a4d3b2e2b0

Added documentation. flys-artifacts/trunk@4395 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Sun, 13 May 2012 21:28:38 +0000
parents 15a3684c6bce
children 32b1e28edb15
rev   line source
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
3 import java.awt.Font;
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
4
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import org.w3c.dom.Document;
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import org.jfree.chart.JFreeChart;
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.jfree.chart.axis.NumberAxis;
733
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
11 import org.jfree.chart.axis.ValueAxis;
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import org.jfree.chart.plot.XYPlot;
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
13 import org.jfree.chart.title.TextTitle;
733
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
14 import org.jfree.data.Range;
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.jfree.data.xy.XYSeries;
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1933
diff changeset
17 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 686
diff changeset
18
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
19 import de.intevation.flys.artifacts.model.FacetTypes;
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.artifacts.model.WQDay;
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
21 import de.intevation.flys.artifacts.resources.Resources;
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2550
diff changeset
23 import de.intevation.flys.jfree.Bounds;
1850
0463e1f80bfd Handle MainValue Facets in Duration Curve Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1713
diff changeset
24 import de.intevation.flys.jfree.FLYSAnnotation;
2074
a026d005accd Moved JFreeChart specific classes to de.intevation.flys.jfree and added required imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2051
diff changeset
25 import de.intevation.flys.jfree.StyledXYSeries;
1850
0463e1f80bfd Handle MainValue Facets in Duration Curve Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1713
diff changeset
26
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 /**
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 * An OutGenerator that generates duration curves.
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 *
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 */
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
33 public class DurationCurveGenerator
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
34 extends XYChartGenerator
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
35 implements FacetTypes
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
36 {
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
37 public static enum YAXIS {
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
38 W(0),
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
39 Q(1);
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
40 public int idx;
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
41 private YAXIS(int c) {
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
42 idx = c;
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
43 }
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
44 }
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
45
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 private static Logger logger =
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 Logger.getLogger(DurationCurveGenerator.class);
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
49 public static final String I18N_DURATION_W =
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
50 "chart.duration.curve.curve.w";
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
52 public static final String I18N_DURATION_Q =
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
53 "chart.duration.curve.curve.q";
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
55 public static final String I18N_CHART_TITLE =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
56 "chart.duration.curve.title";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
57
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
58 public static final String I18N_CHART_SUBTITLE =
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
59 "chart.duration.curve.subtitle";
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
60
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
61 public static final String I18N_XAXIS_LABEL =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
62 "chart.duration.curve.xaxis.label";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
63
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
64 public static final String I18N_YAXIS_LABEL =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
65 "chart.duration.curve.yaxis.label";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
66
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
67 public static final String I18N_CHART_TITLE_DEFAULT =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
68 "Dauerlinie";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
69
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
70 public static final String I18N_XAXIS_LABEL_DEFAULT =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
71 "Unterschreitungsdauer [Tage]";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
72
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
73 public static final String I18N_YAXIS_LABEL_DEFAULT =
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
74 "W [NN + m]";
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
75
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 public DurationCurveGenerator() {
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 super();
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
82 /**
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
83 * Create Axis for given index.
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
84 * @return axis with according internationalized label.
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
85 */
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
86 @Override
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
87 protected NumberAxis createYAxis(int index) {
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
88 Font labelFont = new Font("Tahoma", Font.BOLD, 14);
2000
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
89 String label = getYAxisLabel(index);
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
90
2049
2d5f2bc68cc6 Centralized the creation of new NumberAxis - new NumberAxis instances in FLYS will be from type IdentifiableNumberAxis which subclasses JFreeChart's NumberAxis.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2048
diff changeset
91 NumberAxis axis = createNumberAxis(index, label);
1951
2c9bf9aede64 Fix first axis (do not include zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
92 if (index == YAXIS.W.idx) {
2c9bf9aede64 Fix first axis (do not include zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
93 axis.setAutoRangeIncludesZero(false);
2c9bf9aede64 Fix first axis (do not include zero).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1948
diff changeset
94 }
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
95 axis.setLabelFont(labelFont);
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
96 return axis;
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
97 }
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
98
2048
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
99
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
100 @Override
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
101 protected String getDefaultChartTitle() {
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
102 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
106 @Override
2048
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
107 protected String getDefaultChartSubtitle() {
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
108 double[] dist = getRange();
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
109
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
110 Object[] args = new Object[] {
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
111 getRiverName(),
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
112 dist[0]
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
113 };
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
114
1989
156304542edf Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1951
diff changeset
115 return msg(I18N_CHART_SUBTITLE, "", args);
156304542edf Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1951
diff changeset
116 }
156304542edf Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1951
diff changeset
117
156304542edf Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1951
diff changeset
118
156304542edf Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1951
diff changeset
119 @Override
156304542edf Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1951
diff changeset
120 protected void addSubtitles(JFreeChart chart) {
156304542edf Finished the ChartSection part of the chart Settings returned by the XYChartGenerator.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1951
diff changeset
121 String subtitle = getChartSubtitle();
2048
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
122
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
123 if (subtitle != null && subtitle.length() > 0) {
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
124 chart.addSubtitle(new TextTitle(subtitle));
3157a78e6494 Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2000
diff changeset
125 }
414
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
126 }
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
127
0385bcc4229a Added subtitles to the available charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 408
diff changeset
128
2000
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
129 @Override
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
130 protected String getDefaultXAxisLabel() {
408
fc3ac59c3c8b Enabled i18n support for charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 385
diff changeset
131 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134
2000
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
135 @Override
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
136 protected String getDefaultYAxisLabel(int index) {
2000
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
137 String label = "default";
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
138 if (index == YAXIS.W.idx) {
2051
4ba5036109d2 Make use of user defined axes labels during chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2049
diff changeset
139 label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
2000
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
140 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
141 else if (index == YAXIS.Q.idx) {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
142 // TODO i18n for this label
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
143 label = "Q [m\u00b3/s]";
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
144 //label = msg(get2YAxisLabelKey(), get2YAxisDefaultLabel());
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
145 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
146
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
147 return label;
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
148 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
149
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
150
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
151 @Override
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2550
diff changeset
152 protected boolean zoomX(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2550
diff changeset
153 boolean zoomin = super.zoom(plot, axis, bounds, x);
733
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
154
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
155 if (!zoomin) {
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
156 axis.setLowerBound(0d);
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
157 }
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
158
1713
6d9184c745dd Bugfix: #226 Set the upper bound of duration curve charts to 364.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
159 axis.setUpperBound(364);
6d9184c745dd Bugfix: #226 Set the upper bound of duration curve charts to 364.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1684
diff changeset
160
733
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
161 return zoomin;
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
162 }
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
163
5f5e67aceb8c #172 Charts of type duration curve will now have a lower X set to '0'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 704
diff changeset
164
2550
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
165 /**
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
166 * This method overrides the method in the parent class to set the lower
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
167 * bounds of the Q axis to 0. This axis should never display negative
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
168 * values on its own.
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
169 */
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
170 @Override
2587
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2550
diff changeset
171 protected boolean zoomY(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) {
bece6f604899 Removed references to Range and replaced those with references to Bounds in ChartGenerators.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2550
diff changeset
172 boolean zoomin = super.zoom(plot, axis, bounds, x);
2550
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
173
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
174 if (!zoomin && axis instanceof IdentifiableNumberAxis) {
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
175 String id = ((IdentifiableNumberAxis) axis).getId();
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
176
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
177 if (YAXIS.Q.toString().equals(id)) {
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
178 axis.setLowerBound(0d);
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
179 }
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
180 }
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
181
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
182 return zoomin;
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
183 }
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
184
a992ab2588a8 #509 Set the lower bounds of duration curves Q axis to 0 if no zoom has taken place.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2325
diff changeset
185
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 686
diff changeset
186 @Override
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: 924
diff changeset
187 public void doOut(
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1933
diff changeset
188 ArtifactAndFacet artifactFacet,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1933
diff changeset
189 Document attr,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1933
diff changeset
190 boolean visible
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: 924
diff changeset
191 ) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1933
diff changeset
192 String name = artifactFacet.getFacetName();
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 686
diff changeset
194 logger.debug("DurationCurveGenerator.doOut: " + name);
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 686
diff changeset
195
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 686
diff changeset
196 if (name == null || name.length() == 0) {
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 logger.error("No facet given. Cannot create dataset.");
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 return;
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
201 if (name.equals(DURATION_W)) {
2605
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
202 doWOut(
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
203 (WQDay) artifactFacet.getData(context),
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
204 artifactFacet,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
205 attr,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
206 visible);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
208 else if (name.equals(DURATION_Q)) {
2605
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
209 doQOut(
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
210 (WQDay) artifactFacet.getData(context),
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
211 artifactFacet,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
212 attr,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
213 visible);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214 }
2163
105097966111 Theoretically allow annotations on second y ais. Practically allow Q MainValues on Q Axis in Duration Curves.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2074
diff changeset
215 else if (name.equals(DURATION_MAINVALUES_Q)
1850
0463e1f80bfd Handle MainValue Facets in Duration Curve Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1713
diff changeset
216 || name.equals(MAINVALUES_Q)
0463e1f80bfd Handle MainValue Facets in Duration Curve Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1713
diff changeset
217 || name.equals(COMPUTED_DISCHARGE_MAINVALUES_W)
0463e1f80bfd Handle MainValue Facets in Duration Curve Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1713
diff changeset
218 || name.equals(MAINVALUES_W)
0463e1f80bfd Handle MainValue Facets in Duration Curve Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1713
diff changeset
219 ) {
0463e1f80bfd Handle MainValue Facets in Duration Curve Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1713
diff changeset
220 doAnnotations(
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1933
diff changeset
221 (FLYSAnnotation) artifactFacet.getData(context),
2325
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2206
diff changeset
222 artifactFacet,
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2206
diff changeset
223 attr,
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2206
diff changeset
224 visible);
1850
0463e1f80bfd Handle MainValue Facets in Duration Curve Diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1713
diff changeset
225 }
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
226 else if (FacetTypes.IS.MANUALPOINTS(name)) {
2325
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2206
diff changeset
227 doPoints(
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2206
diff changeset
228 artifactFacet.getData(context),
1fcaeced48f2 #485 Fixed broken renaming of chart themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2206
diff changeset
229 artifactFacet,
2206
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
230 attr, visible, YAXIS.W.idx);
e2124ca11adb Add manual point handling for many different chart types.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2163
diff changeset
231 }
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 else {
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 686
diff changeset
233 logger.warn("Unknown facet name: " + name);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234 return;
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
235 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 /**
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 * Creates the series for a duration curve's W facet.
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241 *
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
242 * @param wqdays The WQDay store that contains the Ws.
924
f7761914f745 An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 923
diff changeset
243 * @param theme
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 */
2605
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
245 protected void doWOut(
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
246 WQDay wqdays,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
247 ArtifactAndFacet aaf,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
248 Document theme,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
249 boolean visible
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
250 ) {
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251 logger.debug("DurationCurveGenerator.doWOut");
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252
2605
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
253 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
254
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255 int size = wqdays.size();
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 for (int i = 0; i < size; i++) {
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257 int day = wqdays.getDay(i);
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 double w = wqdays.getW(i);
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260 series.add((double) day, w);
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
263 addAxisSeries(series, YAXIS.W.idx, visible);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
264 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
265
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
266
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267 /**
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 * Creates the series for a duration curve's Q facet.
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269 *
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270 * @param wqdays The WQDay store that contains the Qs.
924
f7761914f745 An initial implementation to render chart series based on the XML configuration in themes.xml.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 923
diff changeset
271 * @param theme
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272 */
2605
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
273 protected void doQOut(
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
274 WQDay wqdays,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
275 ArtifactAndFacet aaf,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
276 Document theme,
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
277 boolean visible
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
278 ) {
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 logger.debug("DurationCurveGenerator.doQOut");
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280
2605
15a3684c6bce #366 Display correct descriptions in legend panel of charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2587
diff changeset
281 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283 int size = wqdays.size();
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284 for (int i = 0; i < size; i++) {
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
285 int day = wqdays.getDay(i);
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286 double q = wqdays.getQ(i);
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
287
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288 series.add((double) day, q);
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
289 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
290
1933
9e9cfc036a3f Better use multiple axis feature in chart generators.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1931
diff changeset
291 addAxisSeries(series, YAXIS.Q.idx, visible);
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
292 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
293
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
294
2691
a7a4d3b2e2b0 Added documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2605
diff changeset
295 /**
a7a4d3b2e2b0 Added documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2605
diff changeset
296 * Creates an i18ed name for a (w or q) duration curve facet.
a7a4d3b2e2b0 Added documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2605
diff changeset
297 * @param river rivername, included in facet name.
a7a4d3b2e2b0 Added documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2605
diff changeset
298 * @param type either DURATION_W, DURATION_Q
a7a4d3b2e2b0 Added documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2605
diff changeset
299 */
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
300 protected String getSeriesName(String river, String type) {
2691
a7a4d3b2e2b0 Added documentation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2605
diff changeset
301 // TODO include km in duration curves facet name.
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
302 Object[] args = new Object[] { river };
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
303
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
304 if (type == null || type.length() == 0) {
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
305 logger.warn("No duration curve type given.");
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
306 return "n/a";
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
307 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
308 else if (type.equals(DURATION_W)) {
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
309 return Resources.getMsg(
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
310 context.getMeta(),
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
311 I18N_DURATION_W,
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
312 "W",
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
313 args);
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
314 }
696
708b270dfd30 OutGenerators use now facets to fetch necessary data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 695
diff changeset
315 else if (type.equals(DURATION_Q)) {
686
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
316 return Resources.getMsg(
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
317 context.getMeta(),
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
318 I18N_DURATION_Q,
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
319 "W",
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
320 args);
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
321 }
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
322
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
323 logger.warn("Could not determine chart curve type: " + type);
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
324 return type;
3dc61e00385e Merged with trunk and introduced hashing of computed values.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 665
diff changeset
325 }
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1850
diff changeset
326
2000
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
327
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
328 @Override
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
329 protected YAxisWalker getYAxisWalker() {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
330 return new YAxisWalker() {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
331 @Override
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
332 public int length() {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
333 return YAXIS.values().length;
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
334 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
335
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
336 @Override
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
337 public String getId(int idx) {
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
338 YAXIS[] yaxes = YAXIS.values();
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
339 return yaxes[idx].toString();
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
340 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
341 };
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
342 }
e71719483546 Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1989
diff changeset
343
1931
7c52e9cb2a72 Allow more than two datasets and more flexibility with axes in plots. Based on patch by S. Teichmann.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1850
diff changeset
344 // MainValue-Annotations should be visualized by a line that goes to the curve itself.
385
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
345 }
478940d06876 Enabled the WINFO artifact to create duration curves - new OutGenerator, added methods for data computation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
346 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org