Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java @ 2000:e71719483546
Improved the ChartSettings - now, each chart writes proper AxisSections into the ChartSettings.
flys-artifacts/trunk@3441 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 16 Dec 2011 13:37:58 +0000 |
parents | 156304542edf |
children | 3157a78e6494 |
comparison
equal
deleted
inserted
replaced
1999:02ce03329ef5 | 2000:e71719483546 |
---|---|
82 * @return axis with according internationalized label. | 82 * @return axis with according internationalized label. |
83 */ | 83 */ |
84 @Override | 84 @Override |
85 protected NumberAxis createYAxis(int index) { | 85 protected NumberAxis createYAxis(int index) { |
86 Font labelFont = new Font("Tahoma", Font.BOLD, 14); | 86 Font labelFont = new Font("Tahoma", Font.BOLD, 14); |
87 String label = getYAxisLabel(index); | |
88 | |
89 NumberAxis axis = new NumberAxis(label); | |
90 if (index == YAXIS.W.idx) { | |
91 axis.setAutoRangeIncludesZero(false); | |
92 } | |
93 axis.setLabelFont(labelFont); | |
94 return axis; | |
95 } | |
96 | |
97 protected String getChartTitle() { | |
98 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); | |
99 } | |
100 | |
101 | |
102 @Override | |
103 protected String getChartSubtitle() { | |
104 double[] dist = getRange(); | |
105 | |
106 Object[] args = new Object[] { | |
107 getRiverName(), | |
108 dist[0] | |
109 }; | |
110 | |
111 return msg(I18N_CHART_SUBTITLE, "", args); | |
112 } | |
113 | |
114 | |
115 @Override | |
116 protected void addSubtitles(JFreeChart chart) { | |
117 String subtitle = getChartSubtitle(); | |
118 chart.addSubtitle(new TextTitle(subtitle)); | |
119 } | |
120 | |
121 | |
122 @Override | |
123 protected String getXAxisLabel() { | |
124 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); | |
125 } | |
126 | |
127 | |
128 @Override | |
129 protected String getYAxisLabel() { | |
130 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); | |
131 } | |
132 | |
133 | |
134 @Override | |
135 protected String getYAxisLabel(int index) { | |
87 String label = "default"; | 136 String label = "default"; |
88 if (index == YAXIS.W.idx) { | 137 if (index == YAXIS.W.idx) { |
89 label = getYAxisLabel(); | 138 label = getYAxisLabel(); |
90 } | 139 } |
91 else if (index == YAXIS.Q.idx) { | 140 else if (index == YAXIS.Q.idx) { |
92 // TODO i18n for this label | 141 // TODO i18n for this label |
93 label = "Q [m\u00b3/s]"; | 142 label = "Q [m\u00b3/s]"; |
94 //label = msg(get2YAxisLabelKey(), get2YAxisDefaultLabel()); | 143 //label = msg(get2YAxisLabelKey(), get2YAxisDefaultLabel()); |
95 } | 144 } |
96 NumberAxis axis = new NumberAxis(label); | 145 |
97 if (index == YAXIS.W.idx) { | 146 return label; |
98 axis.setAutoRangeIncludesZero(false); | |
99 } | |
100 axis.setLabelFont(labelFont); | |
101 return axis; | |
102 } | |
103 | |
104 protected String getChartTitle() { | |
105 return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); | |
106 } | |
107 | |
108 | |
109 @Override | |
110 protected String getChartSubtitle() { | |
111 double[] dist = getRange(); | |
112 | |
113 Object[] args = new Object[] { | |
114 getRiverName(), | |
115 dist[0] | |
116 }; | |
117 | |
118 return msg(I18N_CHART_SUBTITLE, "", args); | |
119 } | |
120 | |
121 | |
122 @Override | |
123 protected void addSubtitles(JFreeChart chart) { | |
124 String subtitle = getChartSubtitle(); | |
125 chart.addSubtitle(new TextTitle(subtitle)); | |
126 } | |
127 | |
128 | |
129 protected String getXAxisLabel() { | |
130 return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); | |
131 } | |
132 | |
133 | |
134 protected String getYAxisLabel() { | |
135 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); | |
136 } | 147 } |
137 | 148 |
138 | 149 |
139 @Override | 150 @Override |
140 protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) { | 151 protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) { |
261 | 272 |
262 logger.warn("Could not determine chart curve type: " + type); | 273 logger.warn("Could not determine chart curve type: " + type); |
263 return type; | 274 return type; |
264 } | 275 } |
265 | 276 |
277 | |
278 @Override | |
279 protected YAxisWalker getYAxisWalker() { | |
280 return new YAxisWalker() { | |
281 @Override | |
282 public int length() { | |
283 return YAXIS.values().length; | |
284 } | |
285 | |
286 @Override | |
287 public String getId(int idx) { | |
288 YAXIS[] yaxes = YAXIS.values(); | |
289 return yaxes[idx].toString(); | |
290 } | |
291 }; | |
292 } | |
293 | |
266 // MainValue-Annotations should be visualized by a line that goes to the curve itself. | 294 // MainValue-Annotations should be visualized by a line that goes to the curve itself. |
267 } | 295 } |
268 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 296 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |