comparison flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java @ 3409:97ad960f5579

Add subtitle to Fix W/Q chart and refactor addSubtitle() method(s) flys-artifacts/trunk@5062 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 19 Jul 2012 12:59:56 +0000
parents 50d61a2494cb
children b9aff8d6ff74
comparison
equal deleted inserted replaced
3408:50d61a2494cb 3409:97ad960f5579
26 import java.util.Set; 26 import java.util.Set;
27 27
28 import javax.xml.xpath.XPathConstants; 28 import javax.xml.xpath.XPathConstants;
29 29
30 import org.apache.log4j.Logger; 30 import org.apache.log4j.Logger;
31 import org.jfree.chart.JFreeChart;
32 import org.jfree.chart.annotations.XYTextAnnotation; 31 import org.jfree.chart.annotations.XYTextAnnotation;
33 import org.jfree.chart.title.TextTitle;
34 import org.jfree.data.time.Day; 32 import org.jfree.data.time.Day;
35 import org.jfree.data.time.Month; 33 import org.jfree.data.time.Month;
36 import org.jfree.data.time.RegularTimePeriod; 34 import org.jfree.data.time.RegularTimePeriod;
37 import org.jfree.data.time.TimeSeries; 35 import org.jfree.data.time.TimeSeries;
38 import org.jfree.data.time.TimeSeriesCollection; 36 import org.jfree.data.time.TimeSeriesCollection;
116 114
117 115
118 @Override 116 @Override
119 protected String getDefaultChartSubtitle() { 117 protected String getDefaultChartSubtitle() {
120 FixAnalysisAccess access = new FixAnalysisAccess(artifact); 118 FixAnalysisAccess access = new FixAnalysisAccess(artifact);
121 DateRange range = access.getDateRange(); 119 DateRange dateRange = access.getDateRange();
120 DateRange refRange = access.getReferencePeriod();
122 return Resources.format( 121 return Resources.format(
123 context.getMeta(), 122 context.getMeta(),
124 I18N_CHART_SUBTITLE, 123 I18N_CHART_SUBTITLE,
125 "", 124 "",
126 access.getRiver(), 125 access.getRiver(),
127 range.getFrom(), 126 dateRange.getFrom(),
128 range.getTo()); 127 dateRange.getTo(),
129 } 128 refRange.getFrom(),
130 129 refRange.getTo());
131
132 /**
133 * Empty (suppress subtitle).
134 */
135 @Override
136 protected void addSubtitles(JFreeChart chart) {
137 String subtitle = getChartSubtitle();
138
139 if (subtitle != null && subtitle.length() > 0) {
140 chart.addSubtitle(new TextTitle(subtitle));
141 }
142 } 130 }
143 131
144 132
145 @Override 133 @Override
146 protected String getDefaultXAxisLabel() { 134 protected String getDefaultXAxisLabel() {

http://dive4elements.wald.intevation.org