annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesVectorChart.java @ 1145:dfe1ac687c7f tip

added tags
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:16:15 +0200
parents f953c9a559d8
children
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
5 * Read the file LGPL.txt coming with the software for details
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
8
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.chart;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import de.intevation.gnv.geobackend.base.Result;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import de.intevation.gnv.geobackend.base.ResultDescriptor;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import java.util.Collection;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import java.util.Date;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import java.util.Iterator;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import java.util.Locale;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import org.apache.log4j.Logger;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import org.jfree.chart.ChartTheme;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import org.jfree.chart.plot.XYPlot;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 import org.jfree.data.time.Minute;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import org.jfree.data.time.TimeSeries;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import org.jfree.data.time.TimeSeriesCollection;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 /**
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 * This class is used to create timeseries charts that contain components of a
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * vector parameter. The domain axis contains multiple date/time objects.
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 *
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 */
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 public class TimeSeriesVectorChart extends TimeSeriesChart {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 private static Logger logger =Logger.getLogger(TimeSeriesVectorChart.class);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public TimeSeriesVectorChart(
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 ChartLabels labels,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 ChartTheme theme,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 Collection parameters,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 Collection measurements,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 Collection dates,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 Collection result,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 Collection timeGaps,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 Locale locale,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 boolean linesVisible,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 boolean shapesVisible
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 ) {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 super(labels, theme, parameters, measurements, dates, result,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 timeGaps, locale, linesVisible, shapesVisible);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 @Override
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 protected void initData() {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 logger.debug("init data for timeseries vector chart");
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 Iterator iter = resultSet.iterator();
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 Result row = null;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 String seriesName = null;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 TimeSeries series = null;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 int idx = 0;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 int startPos = 0;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 int endPos = 0;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 Date startDate = null;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 Date endDate = null;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 ResultDescriptor rd = null;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 int idxSeries = -1;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 int idxX = -1;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 int idxY = -1;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 Result[] results =
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 (Result[]) resultSet.toArray(new Result[resultSet.size()]);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 while (iter.hasNext()) {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 row = (Result) iter.next();
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 if (rd == null) {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 rd = row.getResultDescriptor();
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 idxSeries = rd.getColumnIndex("SERIES");
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 idxX = rd.getColumnIndex("XORDINATE");
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 idxY = rd.getColumnIndex("YORDINATE");
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 // add current data to plot and prepare for next one
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 if (!row.getString(idxSeries).equals(seriesName)) {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 logger.debug("prepare data/plot for next dataset");
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 if(series != null) {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 // add gaps before adding series to chart
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 startDate = results[startPos].getDate(idxX);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 endDate = results[endPos-1].getDate(idxX);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 addGaps(results,series,startDate,endDate,startPos,endPos);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 addSeries(series, seriesName, idx);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 startPos = endPos + 1;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 // prepare variables for next plot
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 seriesName = row.getString(idxSeries);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 logger.debug("next dataset is '" + seriesName + "'");
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 series = new TimeSeries(seriesName, Minute.class);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 addValue(row, series);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 storeMaxRange(ranges, row.getDouble(idxY), seriesName);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 endPos++;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 if (startPos < results.length && endPos-1 < results.length) {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 // add the last dataset if existing to plot and prepare its axis
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 startDate = results[startPos].getDate(idxX);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 endDate = results[endPos-1].getDate(idxX);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 addGaps(results, series, startDate, endDate, startPos, endPos);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 addSeries(series, seriesName, idx);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 addDatasets();
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 @Override
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 protected void addDatasets() {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 XYPlot plot = chart.getXYPlot();
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 int idx = 0;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 TimeSeriesCollection tsc = null;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 Iterator iter = datasets.keySet().iterator();
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 while (iter.hasNext()) {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 String key = (String) iter.next();
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 tsc = (TimeSeriesCollection)datasets.get(key);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 plot.setDataset(idx, tsc );
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 logger.debug("Added " + key + " parameter to plot.");
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 prepareAxis(key, idx);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 adjustRenderer(
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 idx++,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 tsc.getSeriesCount(),
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 linesVisible,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 shapesVisible
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 );
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org