annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/charts/TimeseriesStepChart.java @ 2671:055315495f8d

Modified floodmap specific datacage configuration and improved WMS catchment layer. flys-artifacts/trunk@4359 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 08 May 2012 12:14:55 +0000
parents 78ac5058da67
children 4bd3d8bbb60c
rev   line source
2232
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.charts;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.awt.Dimension;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.Date;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.util.GregorianCalendar;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import org.jfree.chart.ChartFactory;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import org.jfree.chart.ChartPanel;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import org.jfree.chart.JFreeChart;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.jfree.ui.ApplicationFrame;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import org.jfree.data.time.SimpleTimePeriod;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.jfree.data.time.Second;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import org.jfree.data.time.TimeSeries;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import org.jfree.data.time.TimeSeriesCollection;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import org.jfree.data.time.TimePeriodValues;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import org.jfree.data.time.TimePeriodValuesCollection;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import org.apache.log4j.Logger;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.PropertyConfigurator;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 public class TimeseriesStepChart extends ApplicationFrame {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 private static final Logger logger =
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 Logger.getLogger(TimeseriesStepChart.class);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 public static final String LOG4J_PROPERTIES = "FLYS_CLIENT_LOG4J_PROPERIES";
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 public static final int USER_CHART_TYPE =
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 Integer.getInteger("chart.type", -1);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 public static final int CHART_TYPE_TIMEPERIOD = 1;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 public static final int CHART_TYPE_TIMESERIES = 2;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 public static void main(String[] args) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 configureLogging();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 logger.info("Start TimeseriesStepChart demo.");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 if (USER_CHART_TYPE <= 0) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 logger.error("Unknown chart type: " + USER_CHART_TYPE);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 logger.debug("Create Chart from type: " + USER_CHART_TYPE);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 TimeseriesStepChart tsc = new TimeseriesStepChart();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 tsc.build(USER_CHART_TYPE);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 logger.info("End of TimeseriesStepChart demo.");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 public static void configureLogging() {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 String log4jProperties = System.getenv(LOG4J_PROPERTIES);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 if (log4jProperties != null && log4jProperties.length() > 0) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 PropertyConfigurator.configure(log4jProperties);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 logger.info("Log4J logging initialized.");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 else {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 System.out.println("Error while setting up Log4J configuration.");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 System.out.println("LoggingConfigurator.init finished");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 public TimeseriesStepChart() {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 super("TimeseriesStepChart");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 public void build(int type) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 ChartPanel chartPanel = createChartPanel(type);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 chartPanel.setPreferredSize(new Dimension(500, 300));
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 setContentPane(chartPanel);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 pack();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 setVisible(true);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 protected ChartPanel createChartPanel(int type) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 JFreeChart chart = createJFreeChart(type);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 ChartPanel panel = new ChartPanel(chart);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 return panel;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 protected JFreeChart createJFreeChart(int type) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 if (type == CHART_TYPE_TIMEPERIOD) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 return createTimePeriodValuesChart();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 else if (type == CHART_TYPE_TIMESERIES) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 return createTimeSeriesChart();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 logger.error("Unknown chart type: " + type);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 return null;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 public static Date createDate(int year, int month, int day) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 GregorianCalendar cal = new GregorianCalendar(year, month, day);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 return cal.getTime();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 //
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 // XXX FOLLOWING METHODS ARE USED FOR "TimePeriodValues" CHART TYPE
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 //
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 protected JFreeChart createTimePeriodValuesChart() {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 return ChartFactory.createTimeSeriesChart(
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 "TimePeriodValues Chart",
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 "Time Axis",
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 "Y Axis",
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 createTimePeriodValuesDataset(),
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 true,
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 false,
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 false);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 protected TimePeriodValuesCollection createTimePeriodValuesDataset() {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 TimePeriodValues series = createTimePeriodValues();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 dataset.addSeries(series);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 return dataset;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 protected TimePeriodValues createTimePeriodValues() {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 TimePeriodValues series1 = new TimePeriodValues("Series 1");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 Date start1 = createDate(2000, 0, 1);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 Date end1 = createDate(2000, 11, 31);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 logger.debug("START DATE 1 = " + start1);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 logger.debug("END DATE 1 = " + end1);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 SimpleTimePeriod period1 = new SimpleTimePeriod(start1, end1);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 Date start2 = createDate(2001, 0, 1);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 Date end2 = createDate(2001, 11, 31);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 SimpleTimePeriod period2 = new SimpleTimePeriod(start2, end2);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 Date start3 = createDate(2002, 0, 1);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 Date end3 = createDate(2002, 11, 31);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 SimpleTimePeriod period3 = new SimpleTimePeriod(start3, end3);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 series1.add(period1, 100);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 series1.add(period2, 200);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 series1.add(period3, 150);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 return series1;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 //
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 // XXX FOLLOWING METHODS ARE USED FOR "TimePeriodValues" CHART TYPE
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 //
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 protected JFreeChart createTimeSeriesChart() {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 return ChartFactory.createTimeSeriesChart(
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 "TimeSeriesCollection Chart",
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 "Time Axis",
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 "Y Axis",
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 createTimeSeriesCollectionDataset(),
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 true,
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177 false,
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 false);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 protected TimeSeriesCollection createTimeSeriesCollectionDataset() {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 TimeSeriesCollection dataset = new TimeSeriesCollection();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 TimeSeries[] series = createTimeSeries();
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 for (TimeSeries tmp: series) {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 dataset.addSeries(tmp);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 return dataset;
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 protected TimeSeries[] createTimeSeries() {
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195 TimeSeries series1 = new TimeSeries("Series 1");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 series1.add(new Second(0, 0, 0, 1, 1, 2000), 100);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 series1.add(new Second(59, 59, 23, 31, 12, 2000), 100);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199 series1.add(new Second(0, 0, 0, 1, 1, 2001), 200);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 series1.add(new Second(59, 59, 23, 31, 12, 2001), 200);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 series1.add(new Second(0, 0, 0, 1, 1, 2002), 150);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 series1.add(new Second(59, 59, 23, 31, 12, 2002), 150);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 TimeSeries series2 = new TimeSeries("Series 2");
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206 series2.add(new Second(0, 0, 0, 1, 1, 2000), 10);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207 series2.add(new Second(59, 59, 23, 31, 12, 2000), 10);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
208
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
209 series2.add(new Second(0, 0, 0, 1, 1, 2001), 20);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 series2.add(new Second(59, 59, 23, 31, 12, 2001), 20);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212 series2.add(new Second(0, 0, 0, 1, 1, 2002), 15);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
213 series2.add(new Second(59, 59, 23, 31, 12, 2002), 15);
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
214
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
215 return new TimeSeries[] { series1, series2 };
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 }
78ac5058da67 Added demo standalone app for evaluating different timeseries charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 }

http://dive4elements.wald.intevation.org