Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 375:60f63539d004
Ws and Qs of a longitudinal section chart are mapped to an own range axis now.
flys-artifacts/trunk@1785 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 02 May 2011 09:41:22 +0000 |
parents | 2ce7b473620e |
children | 0385bcc4229a |
comparison
equal
deleted
inserted
replaced
374:91fbaa2744bf | 375:60f63539d004 |
---|---|
9 import org.jfree.chart.ChartFactory; | 9 import org.jfree.chart.ChartFactory; |
10 import org.jfree.chart.JFreeChart; | 10 import org.jfree.chart.JFreeChart; |
11 import org.jfree.chart.axis.NumberAxis; | 11 import org.jfree.chart.axis.NumberAxis; |
12 import org.jfree.chart.plot.PlotOrientation; | 12 import org.jfree.chart.plot.PlotOrientation; |
13 import org.jfree.chart.plot.XYPlot; | 13 import org.jfree.chart.plot.XYPlot; |
14 import org.jfree.data.xy.XYDataset; | |
15 | 14 |
16 import de.intevation.flys.exports.ChartExportHelper; | 15 import de.intevation.flys.exports.ChartExportHelper; |
17 | 16 |
18 | 17 |
19 /** | 18 /** |
47 * @return the Y-Axis label of a chart. | 46 * @return the Y-Axis label of a chart. |
48 */ | 47 */ |
49 protected abstract String getYAxisLabel(); | 48 protected abstract String getYAxisLabel(); |
50 | 49 |
51 /** | 50 /** |
52 * Returns the XYDataset used to add curves to the chart. | 51 * This method is called to add all datasets of a concrete XYChartGenerator |
52 * to the JFreeChart. | |
53 * | 53 * |
54 * @return the XYDataset used to add curves to the chart. | 54 * @param chart The JFreeChart object. |
55 */ | 55 */ |
56 protected abstract XYDataset getXYDataset(); | 56 protected abstract void addDatasets(JFreeChart chart); |
57 | 57 |
58 | 58 |
59 public void generate() | 59 public void generate() |
60 throws IOException | 60 throws IOException |
61 { | 61 { |
63 | 63 |
64 JFreeChart chart = ChartFactory.createXYLineChart( | 64 JFreeChart chart = ChartFactory.createXYLineChart( |
65 getChartTitle(), | 65 getChartTitle(), |
66 getXAxisLabel(), | 66 getXAxisLabel(), |
67 getYAxisLabel(), | 67 getYAxisLabel(), |
68 getXYDataset(), | 68 null, |
69 PlotOrientation.VERTICAL, | 69 PlotOrientation.VERTICAL, |
70 true, | 70 true, |
71 false, | 71 false, |
72 false); | 72 false); |
73 | 73 |
74 chart.setBackgroundPaint(Color.WHITE); | 74 chart.setBackgroundPaint(Color.WHITE); |
75 chart.getPlot().setBackgroundPaint(Color.WHITE); | 75 chart.getPlot().setBackgroundPaint(Color.WHITE); |
76 | |
77 addDatasets(chart); | |
76 | 78 |
77 adjustAxes((XYPlot) chart.getPlot()); | 79 adjustAxes((XYPlot) chart.getPlot()); |
78 | 80 |
79 ChartExportHelper.exportImage( | 81 ChartExportHelper.exportImage( |
80 out, | 82 out, |