annotate gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractChart.java @ 310:45625b5cd6d4

Added timegap definitions to charts. Adapted constructors and constructor calls. gnv-artifacts/trunk@368 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 24 Nov 2009 19:14:58 +0000
parents 9ba2cf8cad8d
children 5f2820e821e0
rev   line source
297
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.chart;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.util.Collection;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.Locale;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.awt.Transparency;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.awt.image.BufferedImage;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import org.apache.log4j.Logger;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.jfree.chart.JFreeChart;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.jfree.chart.ChartTheme;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 /**
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 */
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 public abstract class AbstractChart
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 implements Chart
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 {
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 private static Logger log = Logger.getLogger(AbstractChart.class);
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 protected JFreeChart chart;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 protected Locale locale;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 protected ChartLabels labels;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 protected ChartTheme theme;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 protected Collection parameters;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 protected Collection measurements;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 protected Collection resultSet;
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 protected Collection dates;
310
45625b5cd6d4 Added timegap definitions to charts. Adapted constructors and constructor calls.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 303
diff changeset
31 protected Collection timeGaps;
297
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public abstract JFreeChart generateChart();
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
303
9ba2cf8cad8d Export format of charts is related to mime-type.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 301
diff changeset
35 public BufferedImage exportImage(int width, int height) {
297
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 log.info("export chart as png");
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 return chart.createBufferedImage(
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 width, height, Transparency.BITMASK, null);
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 }
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 public void exportSVG() {
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 log.info("export chart as svg (not implemented yet)");
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 }
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 public void exportPDF() {
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 log.info("export chart as pdf (not implemented yet)");
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 }
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 }
3f43392df3f6 Interface and abstract classes for chart creation implemented.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 // vim:set ts=4 sw=4 si et sta sts=4 fenc=latin1 :

http://dive4elements.wald.intevation.org