Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 1991:0bd7c3cf0af1
Added axis sections into charts Settings.
flys-artifacts/trunk@3427 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 15 Dec 2011 17:10:42 +0000 |
parents | 156304542edf |
children | e1c9f28e2675 |
comparison
equal
deleted
inserted
replaced
1990:5c1e7c1e9e09 | 1991:0bd7c3cf0af1 |
---|---|
1 package de.intevation.flys.exports; | 1 package de.intevation.flys.exports; |
2 | 2 |
3 import java.awt.Font; | 3 import java.awt.Font; |
4 import java.util.ArrayList; | |
5 import java.util.List; | |
4 | 6 |
5 import org.apache.log4j.Logger; | 7 import org.apache.log4j.Logger; |
6 | 8 |
7 import org.jfree.chart.JFreeChart; | 9 import org.jfree.chart.JFreeChart; |
8 import org.jfree.chart.axis.NumberAxis; | 10 import org.jfree.chart.axis.NumberAxis; |
12 import org.jfree.data.xy.XYSeries; | 14 import org.jfree.data.xy.XYSeries; |
13 | 15 |
14 import org.w3c.dom.Document; | 16 import org.w3c.dom.Document; |
15 | 17 |
16 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | 18 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
19 import de.intevation.artifactdatabase.state.Section; | |
17 import de.intevation.artifactdatabase.state.Facet; | 20 import de.intevation.artifactdatabase.state.Facet; |
18 | 21 |
19 import de.intevation.flys.artifacts.FLYSArtifact; | 22 import de.intevation.flys.artifacts.FLYSArtifact; |
20 | 23 |
21 import de.intevation.flys.artifacts.model.FacetTypes; | 24 import de.intevation.flys.artifacts.model.FacetTypes; |
189 * @return axis with according internationalized label. | 192 * @return axis with according internationalized label. |
190 */ | 193 */ |
191 @Override | 194 @Override |
192 protected NumberAxis createYAxis(int index) { | 195 protected NumberAxis createYAxis(int index) { |
193 Font labelFont = new Font("Tahoma", Font.BOLD, 14); | 196 Font labelFont = new Font("Tahoma", Font.BOLD, 14); |
194 String label = "default"; | 197 String label = getYAxisLabel(index); |
195 if (index == YAXIS.W.idx) { | 198 |
196 label = getWAxisLabel(); | |
197 } | |
198 else if (index == YAXIS.Q.idx) { | |
199 label = msg(getQAxisLabelKey(), getQAxisDefaultLabel()); | |
200 } | |
201 else if (index == YAXIS.D.idx) { | |
202 label = msg(I18N_WDIFF_YAXIS_LABEL, I18N_WDIFF_YAXIS_LABEL_DEFAULT); | |
203 } | |
204 NumberAxis axis = new NumberAxis(label); | 199 NumberAxis axis = new NumberAxis(label); |
205 // "Q" Axis shall include 0. | 200 // "Q" Axis shall include 0. |
206 if (index == YAXIS.Q.idx) { | 201 if (index == YAXIS.Q.idx) { |
207 axis.setAutoRangeIncludesZero(true); | 202 axis.setAutoRangeIncludesZero(true); |
208 } | 203 } |
210 axis.setAutoRangeIncludesZero(false); | 205 axis.setAutoRangeIncludesZero(false); |
211 } | 206 } |
212 axis.setLabelFont(labelFont); | 207 axis.setLabelFont(labelFont); |
213 return axis; | 208 return axis; |
214 } | 209 } |
210 | |
211 | |
212 protected String getYAxisLabel(int index) { | |
213 String label = "default"; | |
214 | |
215 if (index == YAXIS.W.idx) { | |
216 label = getWAxisLabel(); | |
217 } | |
218 else if (index == YAXIS.Q.idx) { | |
219 label = msg(getQAxisLabelKey(), getQAxisDefaultLabel()); | |
220 } | |
221 else if (index == YAXIS.D.idx) { | |
222 label = msg(I18N_WDIFF_YAXIS_LABEL, I18N_WDIFF_YAXIS_LABEL_DEFAULT); | |
223 } | |
224 | |
225 return label; | |
226 } | |
227 | |
215 | 228 |
216 /** | 229 /** |
217 * Get default value for the second Y-Axis' label (if no translation was | 230 * Get default value for the second Y-Axis' label (if no translation was |
218 * found). | 231 * found). |
219 */ | 232 */ |
448 | 461 |
449 return prefix != null && prefix.length() > 0 | 462 return prefix != null && prefix.length() > 0 |
450 ? prefix + "(" + name +")" | 463 ? prefix + "(" + name +")" |
451 : name; | 464 : name; |
452 } | 465 } |
466 | |
467 | |
468 @Override | |
469 protected List<Section> buildAxisSections() { | |
470 List<Section> axisSections = new ArrayList<Section>(); | |
471 | |
472 for (YAXIS axis: YAXIS.values()) { | |
473 String identifier = axis.toString(); | |
474 | |
475 AxisSection axisSection = new AxisSection(); | |
476 axisSection.setIdentifier(identifier); | |
477 axisSection.setLabel(getYAxisLabel(axis.idx)); | |
478 | |
479 // TODO font-size | |
480 // TODO fixation | |
481 // TODO lower | |
482 // TODO upper | |
483 | |
484 axisSections.add(axisSection); | |
485 } | |
486 | |
487 return axisSections; | |
488 } | |
453 } | 489 } |
454 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 490 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |