Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java @ 617:3d13fa281a7e
Added new ouput mode: histogram.
gnv-artifacts/trunk@688 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 15 Feb 2010 11:44:01 +0000 |
parents | 4cbcc130cffc |
children | 83f8f98a4f11 |
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; |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
30 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
|
31 import org.jfree.chart.axis.TickUnitSource; |
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 /** |
514
d9d933e06875
Fixed gnv/issue153
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
44 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 */ |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 public class TimeSeriesChart |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 extends AbstractXYLineChart |
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 |
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
|
50 private static final String DATE_FORMAT = "chart.timeseries.date.format"; |
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
|
51 |
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
|
52 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
|
53 |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
54 private static final long NO_TIME_GAP = Long.MAX_VALUE - 1000; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
55 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 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
|
57 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 public TimeSeriesChart( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 ChartLabels labels, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 ChartTheme theme, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 Collection parameters, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 Collection measurements, |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
64 Collection dates, |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 Collection result, |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
66 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
|
67 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
|
68 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
|
69 boolean shapesVisible |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 ) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 this.labels = labels; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 this.theme = theme; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 this.parameters = parameters; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 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
|
75 this.dates = dates; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 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
|
77 this.timeGaps = timeGaps; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 this.locale = locale; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 |
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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 ); |
505
7ff916744f40
Solved issue152. Time intervals of timeseries axis are defined by JFreeChart automatically.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
496
diff
changeset
|
97 |
7ff916744f40
Solved issue152. Time intervals of timeseries axis are defined by JFreeChart automatically.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
496
diff
changeset
|
98 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
|
99 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
|
100 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
|
101 } |
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
|
102 |
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
|
103 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 protected void initData() { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 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
|
106 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 String breakPoint1 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 String breakPoint2 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 String breakPoint3 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 Iterator iter = resultSet.iterator(); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 Result row = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 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
|
114 String parameter = null; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 TimeSeries series = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
117 int idx = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
118 int startPos = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
119 int endPos = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
120 Date startDate = null; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
121 Date endDate = null; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
122 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
123 Result[] results = |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
124 (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
|
125 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 while (iter.hasNext()) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 row = (Result) iter.next(); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 // 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
|
130 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
|
131 !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
|
132 !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
|
133 ) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 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
|
135 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 if(series != null) { |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
137 // 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
|
138 startDate = results[startPos].getDate("XORDINATE"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
139 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
|
140 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
|
141 addSeries(series, parameter, idx); |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
142 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
143 startPos = endPos + 1; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 // 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
|
147 breakPoint1 = row.getString("GROUP1"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 breakPoint2 = row.getString("GROUP2"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 breakPoint3 = row.getString("GROUP3"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 seriesName = createSeriesName( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 breakPoint1, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 breakPoint2, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 breakPoint3 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 ); |
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
|
156 parameter = findParameter(seriesName); |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 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
|
159 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
|
160 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 addValue(row, series); |
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
|
163 storeMaxRange(row.getDouble("YORDINATE"), parameter); |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
164 endPos++; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 |
496
f14c5d1b5b71
Issue142. Paid attention on array length. Parameters without values resulted in ArrayIndexOutOfBoundsExceptions.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
364
diff
changeset
|
167 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
|
168 // 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 } |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
174 |
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
|
175 addDatasets(); |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 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
|
180 ((TimeSeries) series).addOrUpdate( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 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
|
182 row.getDouble("YORDINATE") |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 ); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 |
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 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
|
188 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
|
189 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 if (series == null) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 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
|
192 return; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
194 |
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
|
195 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
|
196 |
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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 |
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
|
202 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
|
203 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
|
204 } |
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
|
205 |
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
|
206 |
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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 |
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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 |
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
|
219 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
|
220 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
|
221 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
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 ); |
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
|
230 } |
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
|
231 } |
298
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 |
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
|
235 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
|
236 ((ValueAxis)axis).setStandardTickUnits(createStandardDateTickUnits( |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
237 TimeZone.getDefault(), |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
238 locale)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
239 } |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
240 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
241 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
242 public static TickUnitSource createStandardDateTickUnits( |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
243 TimeZone zone, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
244 Locale locale) |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
245 { |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
246 /* |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
247 * 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
|
248 * 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
|
249 */ |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
250 if (zone == null) { |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
251 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
|
252 } |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
253 if (locale == null) { |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
254 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
|
255 } |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
256 TickUnits units = new TickUnits(); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
257 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
258 // date formatters |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 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
|
263 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
|
264 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
|
265 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
|
266 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
267 f1.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
268 f2.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
269 f3.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
270 f4.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
271 f5.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
272 f6.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
273 f7.setTimeZone(zone); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
274 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
275 // milliseconds |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
276 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
|
277 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
|
278 DateTickUnitType.MILLISECOND, 1, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
279 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
|
280 DateTickUnitType.MILLISECOND, 1, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
281 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
|
282 DateTickUnitType.MILLISECOND, 5, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
283 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
|
284 DateTickUnitType.MILLISECOND, 10, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
285 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
|
286 DateTickUnitType.MILLISECOND, 10, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
287 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
|
288 DateTickUnitType.MILLISECOND, 10, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
289 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
|
290 DateTickUnitType.MILLISECOND, 50, f1)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
291 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
292 // seconds |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
293 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
|
294 DateTickUnitType.MILLISECOND, 50, f2)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
295 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
|
296 DateTickUnitType.SECOND, 1, f2)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
297 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
|
298 DateTickUnitType.SECOND, 1, f2)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
299 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
|
300 DateTickUnitType.SECOND, 5, f2)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
301 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
302 // minutes |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
303 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
|
304 DateTickUnitType.SECOND, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
305 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
|
306 DateTickUnitType.SECOND, 10, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
307 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
|
308 DateTickUnitType.MINUTE, 1, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
309 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
|
310 DateTickUnitType.MINUTE, 1, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
311 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
|
312 DateTickUnitType.MINUTE, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
313 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
|
314 DateTickUnitType.MINUTE, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
315 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
|
316 DateTickUnitType.MINUTE, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
317 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
318 // hours |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
319 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
|
320 DateTickUnitType.MINUTE, 5, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
321 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
|
322 DateTickUnitType.MINUTE, 10, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
323 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
|
324 DateTickUnitType.MINUTE, 30, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
325 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
|
326 DateTickUnitType.HOUR, 1, f3)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
327 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
|
328 DateTickUnitType.HOUR, 1, f4)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
329 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
330 // days |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
331 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
|
332 DateTickUnitType.HOUR, 1, f5)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
333 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
|
334 DateTickUnitType.HOUR, 1, f5)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
335 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
|
336 DateTickUnitType.DAY, 1, f5)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
337 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
|
338 DateTickUnitType.DAY, 1, f5)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
339 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
340 // months |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
341 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
|
342 DateTickUnitType.DAY, 1, f6)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
343 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
|
344 DateTickUnitType.DAY, 1, f6)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
345 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
|
346 DateTickUnitType.MONTH, 1, f6)); |
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.MONTH, 4, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
348 DateTickUnitType.MONTH, 1, f6)); |
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.MONTH, 6, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
350 DateTickUnitType.MONTH, 1, f6)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
351 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
352 // years |
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.YEAR, 1, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
354 DateTickUnitType.MONTH, 1, f7)); |
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.YEAR, 2, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
356 DateTickUnitType.MONTH, 3, f7)); |
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.YEAR, 5, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
358 DateTickUnitType.YEAR, 1, f7)); |
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.YEAR, 10, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
360 DateTickUnitType.YEAR, 1, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
361 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
|
362 DateTickUnitType.YEAR, 5, f7)); |
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.YEAR, 50, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
364 DateTickUnitType.YEAR, 10, f7)); |
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.YEAR, 100, |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
366 DateTickUnitType.YEAR, 20, f7)); |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
367 |
4cbcc130cffc
Copied method from JFreeChart to adapt date formats.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
514
diff
changeset
|
368 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
|
369 } |
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
|
370 |
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
|
371 |
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
|
372 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
|
373 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
|
374 } |
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
|
375 |
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
|
376 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
377 protected String createSeriesName( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
378 String breakPoint1, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
379 String breakPoint2, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
380 String breakPoint3 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
381 ) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
382 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
|
383 return findValueTitle(parameters, breakPoint1) + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
384 " " + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
385 findValueTitle(measurements, breakPoint2) + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
386 "m"; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
387 } |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
388 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
389 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
390 protected void addGaps( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
391 Result[] results, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
392 Series series, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
393 Date startDate, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
394 Date endDate, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
395 int startPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
396 int endPos |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
397 ) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
398 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
|
399 long maxDiff = calculateGapSize( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
400 startDate, endDate, startPos, endPos, gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
401 ); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
402 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
403 Date last = startDate; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
404 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
|
405 Result res = results[i]; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
406 Date now = res.getDate("XORDINATE"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
407 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
408 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
|
409 // 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
|
410 log.info( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
411 "Gap between " + |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
412 last.toString() + " and " + now.toString() |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
413 ); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
414 last.setTime(last.getTime() + 60000); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
415 ((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
|
416 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
417 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
418 last = now; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
419 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
420 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
421 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
422 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
423 protected long calculateGapSize( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
424 Date start, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
425 Date end, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
426 int startPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
427 int endPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
428 int gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
429 ){ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
430 long maxGap = (end.getTime() - start.getTime()) / 20; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
431 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
|
432 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
433 if (maxGap < interval) |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
434 maxGap = interval + 10; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
435 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
436 return maxGap; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
437 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
438 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
439 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
440 protected long getTimeGapValue( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
441 Date dStart, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
442 Date dEnd, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
443 int pStart, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
444 int pEnd, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
445 int gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
446 ){ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
447 long gap = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
448 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
449 if (gapID < 0 || gapID >= 99) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
450 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
451 if (gapID == -1) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
452 // no gaps in meshes |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
453 gap = NO_TIME_GAP; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
454 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
455 else if (pEnd-pStart < 60) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
456 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
|
457 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
458 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
459 else{ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
460 Iterator it = timeGaps.iterator(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
461 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
462 while (it.hasNext()) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
463 TimeGap tempTimeGap = (TimeGap) it.next(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
464 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
465 if (tempTimeGap.getKey() == gapID){ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
466 String unit = tempTimeGap.getUnit(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
467 int gapValue = tempTimeGap.getValue(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
468 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
469 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
|
470 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
|
471 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
472 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
|
473 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
|
474 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
475 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
|
476 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
|
477 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
478 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
|
479 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
|
480 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
481 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
|
482 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
|
483 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
484 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
|
485 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
|
486 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
487 break; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
488 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
489 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
490 } |
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 return gap; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
493 } |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
494 } |
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
|
495 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |