Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java @ 461:3ddc22aab764
Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
ISSUE137
gnv-artifacts/trunk@515 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 08 Jan 2010 14:27:49 +0000 |
parents | 2413273f1c13 |
children | f14c5d1b5b71 |
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 |
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
|
3 import java.text.DateFormat; |
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
|
4 import java.text.SimpleDateFormat; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.util.Collection; |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
6 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
|
7 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
|
8 import java.util.Iterator; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import java.util.Locale; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 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
|
12 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.jfree.chart.ChartTheme; |
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
|
14 import org.jfree.chart.ChartFactory; |
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
|
15 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
|
16 import org.jfree.chart.axis.DateAxis; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import org.jfree.chart.plot.XYPlot; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import org.jfree.chart.plot.PlotOrientation; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import org.jfree.data.general.Series; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 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
|
21 import org.jfree.data.time.Minute; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 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
|
23 |
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
|
24 import de.intevation.gnv.artifacts.ressource.RessourceFactory; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.gnv.geobackend.base.Result; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
334
diff
changeset
|
26 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
27 import de.intevation.gnv.timeseries.gap.TimeGap; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 /** |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 */ |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public class TimeSeriesChart |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 extends AbstractXYLineChart |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 |
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
|
37 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
|
38 |
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
|
39 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
|
40 |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
41 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
|
42 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 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
|
44 |
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 TimeSeriesChart( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 ChartLabels labels, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 ChartTheme theme, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 Collection parameters, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 Collection measurements, |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
51 Collection dates, |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 Collection result, |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
53 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
|
54 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
|
55 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
|
56 boolean shapesVisible |
298
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 this.labels = labels; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 this.theme = theme; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 this.parameters = parameters; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 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
|
62 this.dates = dates; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 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
|
64 this.timeGaps = timeGaps; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 this.locale = locale; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 ); |
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
|
84 } |
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
|
85 |
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
|
86 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 protected void initData() { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 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
|
89 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 String breakPoint1 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 String breakPoint2 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 String breakPoint3 = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 Iterator iter = resultSet.iterator(); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 Result row = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 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
|
97 String parameter = null; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 TimeSeries series = null; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
100 int idx = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
101 int startPos = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
102 int endPos = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
103 Date startDate = null; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
104 Date endDate = null; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
105 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
106 Result[] results = |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
107 (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
|
108 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 while (iter.hasNext()) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 row = (Result) iter.next(); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 // 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
|
113 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
|
114 !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
|
115 !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
|
116 ) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 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
|
118 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 if(series != null) { |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
120 // 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
|
121 startDate = results[startPos].getDate("XORDINATE"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
122 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
|
123 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
|
124 addSeries(series, parameter, idx); |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
125 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
126 startPos = endPos + 1; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 } |
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 // 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
|
130 breakPoint1 = row.getString("GROUP1"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 breakPoint2 = row.getString("GROUP2"); |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 breakPoint3 = row.getString("GROUP3"); |
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 seriesName = createSeriesName( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 breakPoint1, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 breakPoint2, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 breakPoint3 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 ); |
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
|
139 parameter = findParameter(seriesName); |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 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
|
142 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
|
143 } |
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 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
|
146 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
|
147 endPos++; |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 // add the last dataset if existing to plot and prepare its axis |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
151 startDate = results[startPos].getDate("XORDINATE"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
152 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
|
153 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
|
154 addSeries(series, parameter, idx); |
310
45625b5cd6d4
Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
298
diff
changeset
|
155 |
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
|
156 addDatasets(); |
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 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 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
|
161 ((TimeSeries) series).addOrUpdate( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 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
|
163 row.getDouble("YORDINATE") |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 ); |
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 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 |
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
|
168 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
|
169 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
|
170 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 if (series == null) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 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
|
173 return; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
174 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 |
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
|
176 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
|
177 |
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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 |
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
|
183 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
|
184 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
|
185 } |
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
|
186 |
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
|
187 |
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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 |
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
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 |
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 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 ); |
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 } |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 } |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
214 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
215 |
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
|
216 protected void localizeDomainAxis(Axis axis, Locale locale) { |
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
|
217 if (locale == null) |
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
|
218 return; |
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
|
219 |
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
|
220 log.debug( |
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
|
221 "Set language of axis [" + axis.getLabel() + "] " + |
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
|
222 "to " + locale.toString() |
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
|
223 ); |
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
|
224 |
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
|
225 String dateFormat = getMessage(locale, DATE_FORMAT,DEFAULT_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
|
226 DateFormat format = new SimpleDateFormat(dateFormat, locale); |
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
|
227 ((DateAxis) axis).setDateFormatOverride(format); |
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
|
228 } |
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
|
229 |
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
|
230 |
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
|
231 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
|
232 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
|
233 } |
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
|
234 |
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
|
235 |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 protected String createSeriesName( |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 String breakPoint1, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
238 String breakPoint2, |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
239 String breakPoint3 |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
240 ) { |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
241 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
|
242 return findValueTitle(parameters, breakPoint1) + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
243 " " + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
244 findValueTitle(measurements, breakPoint2) + |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
245 "m"; |
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
246 } |
329
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
247 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
248 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
249 protected void addGaps( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
250 Result[] results, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
251 Series series, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
252 Date startDate, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
253 Date endDate, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
254 int startPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
255 int endPos |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
256 ) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
257 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
|
258 long maxDiff = calculateGapSize( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
259 startDate, endDate, startPos, endPos, gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
260 ); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
261 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
262 Date last = startDate; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
263 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
|
264 Result res = results[i]; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
265 Date now = res.getDate("XORDINATE"); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
266 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
267 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
|
268 // 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
|
269 log.info( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
270 "Gap between " + |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
271 last.toString() + " and " + now.toString() |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
272 ); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
273 last.setTime(last.getTime() + 60000); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
274 ((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
|
275 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
276 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
277 last = now; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
278 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
279 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
280 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
281 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
282 protected long calculateGapSize( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
283 Date start, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
284 Date end, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
285 int startPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
286 int endPos, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
287 int gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
288 ){ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
289 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
|
290 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
|
291 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
292 if (maxGap < interval) |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
293 maxGap = interval + 10; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
294 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
295 return maxGap; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
296 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
297 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
298 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
299 protected long getTimeGapValue( |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
300 Date dStart, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
301 Date dEnd, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
302 int pStart, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
303 int pEnd, |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
304 int gapID |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
305 ){ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
306 long gap = 0; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
307 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
308 if (gapID < 0 || gapID >= 99) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
309 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
310 if (gapID == -1) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
311 // no gaps in meshes |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
312 gap = NO_TIME_GAP; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
313 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
314 else if (pEnd-pStart < 60) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
315 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
|
316 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
317 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
318 else{ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
319 Iterator it = timeGaps.iterator(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
320 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
321 while (it.hasNext()) { |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
322 TimeGap tempTimeGap = (TimeGap) it.next(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
323 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
324 if (tempTimeGap.getKey() == gapID){ |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
325 String unit = tempTimeGap.getUnit(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
326 int gapValue = tempTimeGap.getValue(); |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
327 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
328 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
|
329 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
|
330 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
331 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
|
332 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
|
333 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
334 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
|
335 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
|
336 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
337 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
|
338 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
|
339 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
340 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
|
341 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
|
342 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
343 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
|
344 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
|
345 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
346 break; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
347 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
348 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
349 } |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
350 |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
351 return gap; |
42a5269636eb
Added time gap detection to time series charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
327
diff
changeset
|
352 } |
298
80f7c5dc09c6
Implementation of classes for creating timeseries, verticalprofile and horizontalprofile charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
353 } |
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
|
354 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |