comparison flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionInfoGenerator.java @ 653:67c7020f4ed3

Refactored the chart creation in the ChartInfoGenerators. Now, every chart is created by the XYChartGenerator again. flys-artifacts/trunk@2048 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 03 Jun 2011 07:20:39 +0000
parents bb484489d3df
children
comparison
equal deleted inserted replaced
652:8fa4c5c9cd1a 653:67c7020f4ed3
1 package de.intevation.flys.exports; 1 package de.intevation.flys.exports;
2 2
3 import java.awt.Color;
4
5 import org.apache.log4j.Logger;
6
7 import org.jfree.chart.ChartFactory;
8 import org.jfree.chart.JFreeChart;
9 import org.jfree.chart.plot.PlotOrientation;
10 import org.jfree.chart.plot.XYPlot;
11 3
12 /** 4 /**
13 * A ChartInfoGenerator that generates meta information for specific discharge 5 * A ChartInfoGenerator that generates meta information for specific discharge
14 * longitudinal section curves. 6 * longitudinal section curves.
15 * 7 *
16 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 8 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
17 */ 9 */
18 public class DischargeLongitudinalSectionInfoGenerator 10 public class DischargeLongitudinalSectionInfoGenerator
19 extends ChartInfoGenerator 11 extends ChartInfoGenerator
20 { 12 {
21 private static Logger logger =
22 Logger.getLogger(DischargeLongitudinalSectionInfoGenerator.class);
23
24
25 public DischargeLongitudinalSectionInfoGenerator() { 13 public DischargeLongitudinalSectionInfoGenerator() {
26 super(new DischargeLongitudinalSectionGenerator()); 14 super(new DischargeLongitudinalSectionGenerator());
27 } 15 }
28
29
30 protected int[] getSize() {
31 DischargeLongitudinalSectionGenerator gen =
32 (DischargeLongitudinalSectionGenerator) generator;
33
34 return gen.getSize();
35 }
36
37
38 /**
39 * Creates a chart object.
40 *
41 * @return a chart object.
42 */
43 protected JFreeChart generateChart() {
44 logger.debug("DischargeCurveInfoGenerator.generateChart");
45
46 DischargeLongitudinalSectionGenerator gen =
47 (DischargeLongitudinalSectionGenerator) generator;
48
49 JFreeChart chart = ChartFactory.createXYLineChart(
50 gen.getChartTitle(),
51 gen.getXAxisLabel(),
52 gen.getYAxisLabel(),
53 null,
54 PlotOrientation.VERTICAL,
55 true,
56 false,
57 false);
58
59 chart.setBackgroundPaint(Color.WHITE);
60 chart.getPlot().setBackgroundPaint(Color.WHITE);
61
62 XYPlot plot = (XYPlot) chart.getPlot();
63
64 gen.addDatasets(chart);
65 gen.addSubtitles(chart);
66 gen.adjustPlot(plot);
67 gen.adjustAxes(plot);
68
69 return chart;
70 }
71 } 16 }
72 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 17 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org