Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java @ 859:3fbabd4803d7
ISSUE252 Make it possible to export more than one Layer
gnv-artifacts/trunk@983 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 26 Apr 2010 09:09:20 +0000 |
parents | 2423cefe7d39 |
children | f953c9a559d8 |
rev | line source |
---|---|
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.chart; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
514
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
3 import de.intevation.gnv.artifacts.ressource.RessourceFactory; |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
4 |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
5 import de.intevation.gnv.geobackend.base.Result; |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
6 |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
7 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
8 |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
9 import de.intevation.gnv.timeseries.gap.TimeGap; |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
10 |
526
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
11 import java.text.DateFormat; |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
12 import java.text.SimpleDateFormat; |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
13 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import java.util.Collection; |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
15 import java.util.Date; |
334
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
16 import java.util.HashMap; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import java.util.Iterator; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import java.util.Locale; |
505
7ff916744f40
Solved issue152. Time intervals of timeseries axis are defined by JFreeChart automatically.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
496
diff
changeset
|
19 import java.util.TimeZone; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import org.apache.log4j.Logger; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
514
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
23 import org.jfree.chart.ChartFactory; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import org.jfree.chart.ChartTheme; |
514
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
25 |
315
63f8b3fb7d9a
Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
312
diff
changeset
|
26 import org.jfree.chart.axis.Axis; |
63f8b3fb7d9a
Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
312
diff
changeset
|
27 import org.jfree.chart.axis.DateAxis; |
526
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
28 import org.jfree.chart.axis.DateTickUnit; |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
29 import org.jfree.chart.axis.DateTickUnitType; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
30 import org.jfree.chart.axis.TickUnitSource; |
526
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
31 import org.jfree.chart.axis.TickUnits; |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
32 import org.jfree.chart.axis.ValueAxis; |
514
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
33 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 import org.jfree.chart.plot.PlotOrientation; |
514
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
35 import org.jfree.chart.plot.XYPlot; |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
36 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 import org.jfree.data.general.Series; |
514
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
38 |
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
39 import org.jfree.data.time.Minute; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 import org.jfree.data.time.TimeSeries; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 import org.jfree.data.time.TimeSeriesCollection; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 /** |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
44 * This class is used to create timeseries charts. The domain axis contains |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
45 * multiple date/time objects. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
46 * |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
47 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 */ |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 public class TimeSeriesChart |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 extends AbstractXYLineChart |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
53 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
54 * Constant format which can be useful to format date items. Value is |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
55 * {@value}. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
56 */ |
350
4e6aa2a8c4c0
Changed date representation in timeseries charts. Date format is sourced out to language ressource files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
57 public static final String DEFAULT_DATE_FORMAT = "dd-MMM-yyyy"; |
315
63f8b3fb7d9a
Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
312
diff
changeset
|
58 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
59 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
60 * Constant field used if no gap detection should be done here. This field |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
61 * is used in @see #getTimeGapValue. Value is {@value}. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
62 */ |
642
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
63 public static final long NO_TIME_GAP = Long.MAX_VALUE - 1000; |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
64 |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
65 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
66 * Percentage used for gap detection. Its value is {@value}. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
67 */ |
831
bcdcce146c14
Read a system property to adjust the percentage that defines the size of a gap in charts (issue175).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
788
diff
changeset
|
68 public static int GAP_SIZE = 5; // in percent |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
69 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
70 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
71 * Logger used for logging with log4j. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
72 */ |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 private static Logger log = Logger.getLogger(TimeSeriesChart.class); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
831
bcdcce146c14
Read a system property to adjust the percentage that defines the size of a gap in charts (issue175).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
788
diff
changeset
|
75 static { |
835
2423cefe7d39
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
831
diff
changeset
|
76 /* The percentage defining the width of a gap should be configured in |
831
bcdcce146c14
Read a system property to adjust the percentage that defines the size of a gap in charts (issue175).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
788
diff
changeset
|
77 * conf.xml instead of being configured in a system property */ |
bcdcce146c14
Read a system property to adjust the percentage that defines the size of a gap in charts (issue175).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
788
diff
changeset
|
78 GAP_SIZE = Integer.getInteger("chart.gap.percentage", GAP_SIZE); |
bcdcce146c14
Read a system property to adjust the percentage that defines the size of a gap in charts (issue175).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
788
diff
changeset
|
79 } |
bcdcce146c14
Read a system property to adjust the percentage that defines the size of a gap in charts (issue175).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
788
diff
changeset
|
80 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
82 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
83 * Constructor used to create <code>TimeSeries</code> charts. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
84 * |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
85 * @param labels Labels used to be displayed in title, subtitle and so on. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
86 * @param theme ChartTheme used to adjust the rendering of this chart. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
87 * @param parameters Collection containing a bunch of parameters. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
88 * @param measurements Collection containing a bunch of measurements. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
89 * @param dates Collection containing a bunch of date objects. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
90 * @param result Collection containing a bunch of <code>Result</code> |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
91 * objects which contain the actual data items to be displayed. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
92 * @param timeGaps Collection with timegap definitions. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
93 * @param locale Locale used to specify the format of labels, numbers, ... |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
94 * @param linesVisible Render lines between data points if true, otherwise |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
95 * not. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
96 * @param shapesVisible Render vertices as points if true, otherwise not. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
97 */ |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 public TimeSeriesChart( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 ChartLabels labels, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 ChartTheme theme, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 Collection parameters, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 Collection measurements, |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
103 Collection dates, |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 Collection result, |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
105 Collection timeGaps, |
327
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
315
diff
changeset
|
106 Locale locale, |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
315
diff
changeset
|
107 boolean linesVisible, |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
315
diff
changeset
|
108 boolean shapesVisible |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 ) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 this.labels = labels; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 this.theme = theme; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 this.parameters = parameters; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 this.measurements = measurements; |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
114 this.dates = dates; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 this.resultSet = result; |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
116 this.timeGaps = timeGaps; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 this.locale = locale; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 this.PLOT_ORIENTATION = PlotOrientation.VERTICAL; |
327
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
315
diff
changeset
|
119 this.linesVisible = linesVisible; |
22a6493e8460
New options in chart template: visibility of lines and points in charts and point's size.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
315
diff
changeset
|
120 this.shapesVisible = shapesVisible; |
334
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
121 this.datasets = new HashMap(); |
364
2413273f1c13
Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
350
diff
changeset
|
122 this.ranges = new HashMap(); |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
126 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
127 * see de.intevation.gnv.chart.AbstractXYLineChart#initChart() |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
128 */ |
788
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
129 @Override |
333
19571fd1d0e8
Sourced ChartFactory call out to an own method, which is overriden by TimeSeriesChart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
329
diff
changeset
|
130 protected void initChart() { |
312
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
131 chart = ChartFactory.createTimeSeriesChart( |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
132 labels.getTitle(), |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
133 labels.getDomainAxisLabel(), |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
134 null, |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
135 null, |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
136 true, |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
137 false, |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
138 false |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
139 ); |
505
7ff916744f40
Solved issue152. Time intervals of timeseries axis are defined by JFreeChart automatically.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
496
diff
changeset
|
140 |
7ff916744f40
Solved issue152. Time intervals of timeseries axis are defined by JFreeChart automatically.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
496
diff
changeset
|
141 XYPlot plot = (XYPlot) chart.getPlot(); |
7ff916744f40
Solved issue152. Time intervals of timeseries axis are defined by JFreeChart automatically.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
496
diff
changeset
|
142 plot.setDomainAxis(0, new DateAxis( |
7ff916744f40
Solved issue152. Time intervals of timeseries axis are defined by JFreeChart automatically.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
496
diff
changeset
|
143 labels.getDomainAxisLabel(), TimeZone.getDefault(), locale)); |
312
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
144 } |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
145 |
19fbd03544ea
Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
310
diff
changeset
|
146 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
147 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
148 * @see de.intevation.gnv.chart.AbstractXYLineChart#initData() |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
149 */ |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 protected void initData() { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 log.debug("init data for timeseries chart"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 String breakPoint1 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 String breakPoint2 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 String breakPoint3 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 Iterator iter = resultSet.iterator(); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 Result row = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 String seriesName = null; |
364
2413273f1c13
Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
350
diff
changeset
|
160 String parameter = null; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 TimeSeries series = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
163 int idx = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
164 int startPos = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
165 int endPos = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
166 Date startDate = null; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
167 Date endDate = null; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
168 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
169 Result[] results = |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
170 (Result[]) resultSet.toArray(new Result[resultSet.size()]); |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 while (iter.hasNext()) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
173 row = (Result) iter.next(); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 // add current data to plot and prepare for next one |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 if (!row.getString("GROUP1").equals(breakPoint1) || |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 !row.getString("GROUP2").equals(breakPoint2) || |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 !row.getString("GROUP3").equals(breakPoint3) |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 ) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 log.debug("prepare data/plot for next dataset"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 if(series != null) { |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
183 // add gaps before adding series to chart |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
184 startDate = results[startPos].getDate("XORDINATE"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
185 endDate = results[endPos-1].getDate("XORDINATE"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
186 addGaps(results,series,startDate,endDate,startPos,endPos); |
364
2413273f1c13
Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
350
diff
changeset
|
187 addSeries(series, parameter, idx); |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
188 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
189 startPos = endPos + 1; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 // prepare variables for next plot |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 breakPoint1 = row.getString("GROUP1"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 breakPoint2 = row.getString("GROUP2"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
195 breakPoint3 = row.getString("GROUP3"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
196 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
197 seriesName = createSeriesName( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
198 breakPoint1, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
199 breakPoint2, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
200 breakPoint3 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
201 ); |
364
2413273f1c13
Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
350
diff
changeset
|
202 parameter = findParameter(seriesName); |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
203 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
204 log.debug("next dataset is '" + seriesName + "'"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
205 series = new TimeSeries(seriesName, Minute.class); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
206 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
207 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
208 addValue(row, series); |
656
b98d1adee7a6
Added an offset of five percent between values and chart border in vertical profile charts (issue186).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
642
diff
changeset
|
209 storeMaxRange(ranges, row.getDouble("YORDINATE"), parameter); |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
210 endPos++; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
211 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
212 |
496
f14c5d1b5b71
Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
213 if (startPos < results.length && endPos-1 < results.length) { |
f14c5d1b5b71
Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
214 // add the last dataset if existing to plot and prepare its axis |
f14c5d1b5b71
Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
215 startDate = results[startPos].getDate("XORDINATE"); |
f14c5d1b5b71
Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
216 endDate = results[endPos-1].getDate("XORDINATE"); |
f14c5d1b5b71
Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
217 addGaps(results, series, startDate, endDate, startPos, endPos); |
f14c5d1b5b71
Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
218 addSeries(series, parameter, idx); |
f14c5d1b5b71
Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
219 } |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
220 |
334
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
221 addDatasets(); |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
222 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
223 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
224 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
225 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
226 * @see de.intevation.gnv.chart.AbstractXYLineChart#addValue(Result, Series) |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
227 */ |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
228 protected void addValue(Result row, Series series) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 ((TimeSeries) series).addOrUpdate( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
230 new Minute(row.getDate("XORDINATE")), |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
231 row.getDouble("YORDINATE") |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
232 ); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
233 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
234 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
236 /** |
788
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
237 * @param parameter |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
238 * @see de.intevation.gnv.chart.AbstractXYLineChart#addSeries(Series, |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
239 * String, int) |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
240 */ |
364
2413273f1c13
Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
350
diff
changeset
|
241 protected void addSeries(Series series, String parameter, int idx) { |
2413273f1c13
Workarround: Store lower and upper bounds of data while iterating over all data and set the max range of axes with these information. JFreeCharts method NumberAxis.setAutoRange(true) doesn't seem to work properly.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
350
diff
changeset
|
242 log.debug("add series (" + parameter + ")to timeseries chart"); |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 if (series == null) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 log.warn("no data to add"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 return; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
247 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
248 |
334
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
249 TimeSeriesCollection tsc = null; |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
250 |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
251 if (datasets.containsKey(parameter)) |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
252 tsc = (TimeSeriesCollection) datasets.get(parameter); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
253 else |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
254 tsc = new TimeSeriesCollection(); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
255 |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
256 tsc.addSeries((TimeSeries) series); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
257 datasets.put(parameter, tsc); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
258 } |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
259 |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
260 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
261 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
262 * Method to add processed datasets to plot. Each dataset is adjusted using |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
263 * <code>prepareAxis</code> and <code>adjustRenderer</code> methods. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
264 */ |
334
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
265 protected void addDatasets() { |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
266 Iterator iter = parameters.iterator(); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
267 XYPlot plot = chart.getXYPlot(); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
268 int idx = 0; |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
269 |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
270 TimeSeriesCollection tsc = null; |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
271 KeyValueDescibeData data = null; |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
272 String key = null; |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
273 while (iter.hasNext()) { |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
274 data = (KeyValueDescibeData) iter.next(); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
275 key = data.getValue(); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
276 |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
277 if (datasets.containsKey(key)) { |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
278 tsc = (TimeSeriesCollection)datasets.get(key); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
279 plot.setDataset(idx, tsc ); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
280 log.debug("Added " + key + " parameter to plot."); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
281 prepareAxis(key, idx); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
282 adjustRenderer( |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
283 idx++, |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
284 tsc.getSeriesCount(), |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
285 linesVisible, |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
286 shapesVisible |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
287 ); |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
288 } |
e37930705daa
Changed the way of adding data to charts. Same parameters have one axis - not each parameter its own one.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
333
diff
changeset
|
289 } |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
290 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
291 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
292 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
293 /** |
788
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
294 * @param locale |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
295 * @see de.intevation.gnv.chart.AbstractXYLineChart#localizeDomainAxis(Axis, |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
296 * Locale) |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
297 */ |
315
63f8b3fb7d9a
Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
312
diff
changeset
|
298 protected void localizeDomainAxis(Axis axis, Locale locale) { |
526
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
299 ((ValueAxis)axis).setStandardTickUnits(createStandardDateTickUnits( |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
300 TimeZone.getDefault(), |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
301 locale)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
302 } |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
303 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
304 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
305 /** |
788
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
306 * @param zone |
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
307 * @param locale |
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
308 * @return TickUnitSource |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
309 * @see org.jfree.chart.axis.DateAxis#createStandardDateTickUnits(TimeZone, |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
310 * Locale) |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
311 */ |
526
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
312 public static TickUnitSource createStandardDateTickUnits( |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
313 TimeZone zone, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
314 Locale locale) |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
315 { |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
767
diff
changeset
|
316 /* |
526
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
317 * This method have been copied from JFreeChart's DateAxis class. |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
318 * DateFormat objects are hard coded in DateAxis and cannot be adjusted. |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
319 */ |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
320 if (zone == null) { |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
321 throw new IllegalArgumentException("Null 'zone' argument."); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
322 } |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
323 if (locale == null) { |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
324 throw new IllegalArgumentException("Null 'locale' argument."); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
325 } |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
326 TickUnits units = new TickUnits(); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
327 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
328 // date formatters |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
329 DateFormat f1 = new SimpleDateFormat("HH:mm:ss.SSS", locale); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
330 DateFormat f2 = new SimpleDateFormat("HH:mm:ss", locale); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
331 DateFormat f3 = new SimpleDateFormat("HH:mm", locale); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
332 DateFormat f4 = new SimpleDateFormat("d-MMM, HH:mm", locale); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
333 DateFormat f5 = new SimpleDateFormat("d-MMM yyyy", locale); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
334 DateFormat f6 = new SimpleDateFormat("MMM-yyyy", locale); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
335 DateFormat f7 = new SimpleDateFormat("yyyy", locale); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
336 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
337 f1.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
338 f2.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
339 f3.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
340 f4.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
341 f5.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
342 f6.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
343 f7.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
344 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
345 // milliseconds |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
346 units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 1, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
347 units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 5, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
348 DateTickUnitType.MILLISECOND, 1, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
349 units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 10, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
350 DateTickUnitType.MILLISECOND, 1, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
351 units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 25, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
352 DateTickUnitType.MILLISECOND, 5, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
353 units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 50, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
354 DateTickUnitType.MILLISECOND, 10, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
355 units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 100, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
356 DateTickUnitType.MILLISECOND, 10, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
357 units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 250, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
358 DateTickUnitType.MILLISECOND, 10, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
359 units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 500, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
360 DateTickUnitType.MILLISECOND, 50, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
361 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
362 // seconds |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
363 units.add(new DateTickUnit(DateTickUnitType.SECOND, 1, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
364 DateTickUnitType.MILLISECOND, 50, f2)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
365 units.add(new DateTickUnit(DateTickUnitType.SECOND, 5, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
366 DateTickUnitType.SECOND, 1, f2)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
367 units.add(new DateTickUnit(DateTickUnitType.SECOND, 10, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
368 DateTickUnitType.SECOND, 1, f2)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
369 units.add(new DateTickUnit(DateTickUnitType.SECOND, 30, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
370 DateTickUnitType.SECOND, 5, f2)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
371 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
372 // minutes |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
373 units.add(new DateTickUnit(DateTickUnitType.MINUTE, 1, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
374 DateTickUnitType.SECOND, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
375 units.add(new DateTickUnit(DateTickUnitType.MINUTE, 2, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
376 DateTickUnitType.SECOND, 10, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
377 units.add(new DateTickUnit(DateTickUnitType.MINUTE, 5, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
378 DateTickUnitType.MINUTE, 1, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
379 units.add(new DateTickUnit(DateTickUnitType.MINUTE, 10, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
380 DateTickUnitType.MINUTE, 1, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
381 units.add(new DateTickUnit(DateTickUnitType.MINUTE, 15, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
382 DateTickUnitType.MINUTE, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
383 units.add(new DateTickUnit(DateTickUnitType.MINUTE, 20, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
384 DateTickUnitType.MINUTE, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
385 units.add(new DateTickUnit(DateTickUnitType.MINUTE, 30, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
386 DateTickUnitType.MINUTE, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
387 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
388 // hours |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
389 units.add(new DateTickUnit(DateTickUnitType.HOUR, 1, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
390 DateTickUnitType.MINUTE, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
391 units.add(new DateTickUnit(DateTickUnitType.HOUR, 2, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
392 DateTickUnitType.MINUTE, 10, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
393 units.add(new DateTickUnit(DateTickUnitType.HOUR, 4, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
394 DateTickUnitType.MINUTE, 30, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
395 units.add(new DateTickUnit(DateTickUnitType.HOUR, 6, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
396 DateTickUnitType.HOUR, 1, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
397 units.add(new DateTickUnit(DateTickUnitType.HOUR, 12, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
398 DateTickUnitType.HOUR, 1, f4)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
399 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
400 // days |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
401 units.add(new DateTickUnit(DateTickUnitType.DAY, 1, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
402 DateTickUnitType.HOUR, 1, f5)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
403 units.add(new DateTickUnit(DateTickUnitType.DAY, 2, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
404 DateTickUnitType.HOUR, 1, f5)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
405 units.add(new DateTickUnit(DateTickUnitType.DAY, 7, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
406 DateTickUnitType.DAY, 1, f5)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
407 units.add(new DateTickUnit(DateTickUnitType.DAY, 15, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
408 DateTickUnitType.DAY, 1, f5)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
409 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
410 // months |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
411 units.add(new DateTickUnit(DateTickUnitType.MONTH, 1, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
412 DateTickUnitType.DAY, 1, f6)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
413 units.add(new DateTickUnit(DateTickUnitType.MONTH, 2, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
414 DateTickUnitType.DAY, 1, f6)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
415 units.add(new DateTickUnit(DateTickUnitType.MONTH, 3, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
416 DateTickUnitType.MONTH, 1, f6)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
417 units.add(new DateTickUnit(DateTickUnitType.MONTH, 4, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
418 DateTickUnitType.MONTH, 1, f6)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
419 units.add(new DateTickUnit(DateTickUnitType.MONTH, 6, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
420 DateTickUnitType.MONTH, 1, f6)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
421 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
422 // years |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
423 units.add(new DateTickUnit(DateTickUnitType.YEAR, 1, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
424 DateTickUnitType.MONTH, 1, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
425 units.add(new DateTickUnit(DateTickUnitType.YEAR, 2, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
426 DateTickUnitType.MONTH, 3, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
427 units.add(new DateTickUnit(DateTickUnitType.YEAR, 5, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
428 DateTickUnitType.YEAR, 1, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
429 units.add(new DateTickUnit(DateTickUnitType.YEAR, 10, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
430 DateTickUnitType.YEAR, 1, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
431 units.add(new DateTickUnit(DateTickUnitType.YEAR, 25, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
432 DateTickUnitType.YEAR, 5, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
433 units.add(new DateTickUnit(DateTickUnitType.YEAR, 50, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
434 DateTickUnitType.YEAR, 10, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
435 units.add(new DateTickUnit(DateTickUnitType.YEAR, 100, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
436 DateTickUnitType.YEAR, 20, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
437 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
438 return units; |
315
63f8b3fb7d9a
Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
312
diff
changeset
|
439 } |
63f8b3fb7d9a
Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
312
diff
changeset
|
440 |
63f8b3fb7d9a
Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
312
diff
changeset
|
441 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
442 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
443 * Method to get a message from resource bundle. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
444 * |
788
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
445 * @param locale Locale used to specify the resource bundle. |
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
446 * @param key Key to specify the required message. |
e8a9e84a0328
Corrected JavaDoc errors in Chart Package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
779
diff
changeset
|
447 * @param def Default string if resource is not existing. |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
448 * |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
449 * @return Message |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
450 */ |
350
4e6aa2a8c4c0
Changed date representation in timeseries charts. Date format is sourced out to language ressource files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
451 protected String getMessage(Locale locale, String key, String def) { |
4e6aa2a8c4c0
Changed date representation in timeseries charts. Date format is sourced out to language ressource files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
452 return RessourceFactory.getInstance().getRessource(locale, key, def); |
4e6aa2a8c4c0
Changed date representation in timeseries charts. Date format is sourced out to language ressource files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
453 } |
4e6aa2a8c4c0
Changed date representation in timeseries charts. Date format is sourced out to language ressource files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
454 |
4e6aa2a8c4c0
Changed date representation in timeseries charts. Date format is sourced out to language ressource files.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
347
diff
changeset
|
455 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
456 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
457 * @see de.intevation.gnv.chart.AbstractXYLineChart#createSeriesName(String, |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
458 * String, String) |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
459 */ |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
460 protected String createSeriesName( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
461 String breakPoint1, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
462 String breakPoint2, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
463 String breakPoint3 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
464 ) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
465 log.debug("create seriesname of timeseries chart"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
466 return findValueTitle(parameters, breakPoint1) + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
467 " " + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
468 findValueTitle(measurements, breakPoint2) + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
469 "m"; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
470 } |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
471 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
472 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
473 /** |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
767
diff
changeset
|
474 * Method to add gaps between two data points. The max valid space between |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
475 * two data points is calculated by <code>calculateGapSize</code>. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
476 * |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
477 * @param results All data points in this dataset. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
478 * @param series Series to be processed. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
479 * @param startDate Date item where the scan for gaps should begin. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
480 * @param endDate Date item where the scan should end. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
481 * @param startPos Start position of this series in <code>results</code>. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
482 * @param endPos End position of a series in <code>results</code> |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
483 */ |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
484 protected void addGaps( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
485 Result[] results, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
486 Series series, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
487 Date startDate, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
488 Date endDate, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
489 int startPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
490 int endPos |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
491 ) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
492 int gapID = results[startPos].getInteger("GAPID"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
493 long maxDiff = calculateGapSize( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
494 startDate, endDate, startPos, endPos, gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
495 ); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
496 |
642
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
497 if (log.isDebugEnabled()) { |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
498 log.debug("*****************************************************"); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
499 log.debug("Values of gap detection."); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
500 log.debug("Start date: " + startDate.toString()); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
501 log.debug("End date: " + endDate.toString()); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
502 long diff = endDate.getTime() - startDate.getTime(); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
503 log.debug("Time difference (in ms): " + diff); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
504 log.debug("Time difference (in h): " + (diff/(1000*60*60))); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
505 log.debug("Configured gap size (in %): " + GAP_SIZE); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
506 log.debug("Calculated gap size (in ms): " + maxDiff); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
507 log.debug("Calculated gap size (in h): " + (maxDiff/(1000*60*60))); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
508 log.debug("*****************************************************"); |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
509 } |
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
510 |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
511 Date last = startDate; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
512 for (int i = startPos+1; i < endPos; i++) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
513 Result res = results[i]; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
514 Date now = res.getDate("XORDINATE"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
515 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
516 if ((now.getTime() - last.getTime()) > maxDiff) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
517 // add gap, add 1 minute to last date and add null value |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
518 log.info( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
519 "Gap between " + |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
520 last.toString() + " and " + now.toString() |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
521 ); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
522 last.setTime(last.getTime() + 60000); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
523 ((TimeSeries) series).addOrUpdate(new Minute(last), null); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
524 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
525 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
526 last = now; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
527 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
528 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
529 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
530 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
531 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
532 * Method to calculate the max space between two data points. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
533 * |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
534 * @param start First date |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
535 * @param end Last date |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
536 * @param startPos Start position of the current series in the collection |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
537 * containing the bunch of series. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
538 * @param endPos End position of the current series in the collection |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
539 * containing the bunch of series. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
540 * @param gapID Gap id used to specify the time intervals. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
541 * |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
542 * @return Min size of a gap. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
543 */ |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
544 protected long calculateGapSize( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
545 Date start, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
546 Date end, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
547 int startPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
548 int endPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
549 int gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
550 ){ |
642
83f8f98a4f11
Log important values used for gap detection if debug level is enabled.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
526
diff
changeset
|
551 long maxGap = (end.getTime() - start.getTime()) / 100 * GAP_SIZE; |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
552 long interval = getTimeGapValue(start, end, startPos, endPos, gapID); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
553 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
554 if (maxGap < interval) |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
555 maxGap = interval + 10; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
556 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
557 return maxGap; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
558 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
559 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
560 |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
561 /** |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
562 * Determine the interval size between two data points. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
563 * |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
564 * @param dStart Start date |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
565 * @param dEnd End date |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
767
diff
changeset
|
566 * @param pStart Index of start point in series used to specify the total |
767
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
567 * amount of date items. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
568 * @param pEnd Index of end point in series used to specify the total amount |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
569 * of date items. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
570 * @param gapID Gap id used to determine gaps configured in a xml document. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
571 * |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
572 * @return Interval size between two data points. |
79401c871da4
Added and repaired javadoc in de.intevation.gnv.chart package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
656
diff
changeset
|
573 */ |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
574 protected long getTimeGapValue( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
575 Date dStart, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
576 Date dEnd, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
577 int pStart, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
578 int pEnd, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
579 int gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
580 ){ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
581 long gap = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
582 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
583 if (gapID < 0 || gapID >= 99) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
584 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
585 if (gapID == -1) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
586 // no gaps in meshes |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
587 gap = NO_TIME_GAP; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
588 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
589 else if (pEnd-pStart < 60) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
590 gap = (3/(pEnd-pStart)) * (dEnd.getTime() - dStart.getTime()); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
591 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
592 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
593 else{ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
594 Iterator it = timeGaps.iterator(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
595 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
596 while (it.hasNext()) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
597 TimeGap tempTimeGap = (TimeGap) it.next(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
598 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
599 if (tempTimeGap.getKey() == gapID){ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
600 String unit = tempTimeGap.getUnit(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
601 int gapValue = tempTimeGap.getValue(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
602 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
603 if (unit.equals(TimeGap.TIME_UNIT_MINUTE)) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
604 gap = gapValue * TimeGap.MINUTE_IN_MILLIS; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
605 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
606 else if (unit.equals(TimeGap.TIME_UNIT_HOUR)) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
607 gap = gapValue * TimeGap.HOUR_IN_MILLIS; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
608 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
609 else if (unit.equals(TimeGap.TIME_UNIT_DAY)) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
610 gap = gapValue * TimeGap.DAY_IN_MILLIS; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
611 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
612 else if (unit.equals(TimeGap.TIME_UNIT_WEEK)) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
613 gap = gapValue * TimeGap.WEEK_IN_MILLIS; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
614 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
615 else if (unit.equals(TimeGap.TIME_UNIT_MONTH)) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
616 gap = gapValue * (TimeGap.DAY_IN_MILLIS *30); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
617 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
618 else if (unit.equals(TimeGap.TIME_UNIT_YEAR)) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
619 gap = gapValue * (TimeGap.DAY_IN_MILLIS *365); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
620 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
621 break; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
622 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
623 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
624 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
625 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
626 return gap; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
627 } |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
628 } |
315
63f8b3fb7d9a
Localization of chart axis with locale which fits best to server and browser settings.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
312
diff
changeset
|
629 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |