Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveInfoGenerator.java @ 648:d4c4fefb095b
The matrix that is used to transform chart image coordinates into chart coordinates supports inverted x-axis now.
flys-artifacts/trunk@2037 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 01 Jun 2011 09:18:00 +0000 |
parents | bb484489d3df |
children | 67c7020f4ed3 |
rev | line source |
---|---|
647
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.exports; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.awt.Color; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.jfree.chart.ChartFactory; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import org.jfree.chart.JFreeChart; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import org.jfree.chart.plot.PlotOrientation; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import org.jfree.chart.plot.XYPlot; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 /** |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 * A ChartInfoGenerator that generates meta information for specific discharge |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 * curves. |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 * |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 */ |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 public class DischargeCurveInfoGenerator extends ChartInfoGenerator { |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 /** The logger used in this generator.*/ |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 private static Logger logger = |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 Logger.getLogger(DischargeCurveInfoGenerator.class); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 public DischargeCurveInfoGenerator() { |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 super(new DischargeCurveGenerator()); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 protected int[] getSize() { |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 DischargeCurveGenerator gen = (DischargeCurveGenerator) generator; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 return gen.getSize(); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 /** |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 * Creates a chart object. |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 * |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 * @return a chart object. |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 */ |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 protected JFreeChart generateChart() { |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 logger.debug("DischargeCurveInfoGenerator.generateChart"); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 DischargeCurveGenerator gen = (DischargeCurveGenerator) generator; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 JFreeChart chart = ChartFactory.createXYLineChart( |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 gen.getChartTitle(), |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 gen.getXAxisLabel(), |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 gen.getYAxisLabel(), |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 null, |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 PlotOrientation.VERTICAL, |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 true, |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 false, |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 false); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 chart.setBackgroundPaint(Color.WHITE); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 chart.getPlot().setBackgroundPaint(Color.WHITE); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 XYPlot plot = (XYPlot) chart.getPlot(); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 gen.addDatasets(chart); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 gen.addSubtitles(chart); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 gen.adjustPlot(plot); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 gen.adjustAxes(plot); |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 return chart; |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 } |
bb484489d3df
Introduced a new output generators for creating chart info documents.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |