Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractChart.java @ 318:5f2820e821e0
Implemented a helper class for exporting charts. Adapted code.
gnv-artifacts/trunk@376 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 26 Nov 2009 16:10:47 +0000 |
parents | 45625b5cd6d4 |
children | 22a6493e8460 |
comparison
equal
deleted
inserted
replaced
317:342cd58291f1 | 318:5f2820e821e0 |
---|---|
1 package de.intevation.gnv.chart; | 1 package de.intevation.gnv.chart; |
2 | 2 |
3 import java.util.Collection; | 3 import java.util.Collection; |
4 import java.util.Locale; | 4 import java.util.Locale; |
5 import java.awt.Transparency; | |
6 import java.awt.image.BufferedImage; | |
7 | |
8 import org.apache.log4j.Logger; | |
9 | 5 |
10 import org.jfree.chart.JFreeChart; | 6 import org.jfree.chart.JFreeChart; |
11 import org.jfree.chart.ChartTheme; | 7 import org.jfree.chart.ChartTheme; |
12 | 8 |
13 /** | 9 /** |
14 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> | 10 * @author Ingo Weinzierl <ingo.weinzierl@intevation.de> |
15 */ | 11 */ |
16 public abstract class AbstractChart | 12 public abstract class AbstractChart |
17 implements Chart | 13 implements Chart |
18 { | 14 { |
19 private static Logger log = Logger.getLogger(AbstractChart.class); | |
20 | |
21 protected JFreeChart chart; | 15 protected JFreeChart chart; |
22 | 16 |
23 protected Locale locale; | 17 protected Locale locale; |
24 | 18 |
25 protected ChartLabels labels; | 19 protected ChartLabels labels; |
29 protected Collection resultSet; | 23 protected Collection resultSet; |
30 protected Collection dates; | 24 protected Collection dates; |
31 protected Collection timeGaps; | 25 protected Collection timeGaps; |
32 | 26 |
33 public abstract JFreeChart generateChart(); | 27 public abstract JFreeChart generateChart(); |
34 | |
35 public BufferedImage exportImage(int width, int height) { | |
36 log.info("export chart as png"); | |
37 | |
38 return chart.createBufferedImage( | |
39 width, height, Transparency.BITMASK, null); | |
40 } | |
41 | |
42 public void exportSVG() { | |
43 log.info("export chart as svg (not implemented yet)"); | |
44 } | |
45 | |
46 public void exportPDF() { | |
47 log.info("export chart as pdf (not implemented yet)"); | |
48 } | |
49 } | 28 } |
50 // vim:set ts=4 sw=4 si et sta sts=4 fenc=latin1 : | 29 // vim:set ts=4 sw=4 si et sta sts=4 fenc=latin1 : |