Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java @ 3770:6a08f4dc790b
Manual Points for fixing charts (not working yet)
flys-artifacts/trunk@5475 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Sat, 15 Sep 2012 07:07:51 +0000 |
parents | e727e3ebdf85 |
children | 36507c71725b |
comparison
equal
deleted
inserted
replaced
3769:728ecd2afa20 | 3770:6a08f4dc790b |
---|---|
1 package de.intevation.flys.exports.fixings; | 1 package de.intevation.flys.exports.fixings; |
2 | |
3 import java.awt.BasicStroke; | |
4 import java.awt.Color; | |
5 import java.text.DateFormat; | |
6 import java.util.ArrayList; | |
7 import java.util.List; | |
8 | |
9 import org.apache.log4j.Logger; | |
10 import org.jfree.chart.JFreeChart; | |
11 import org.jfree.chart.annotations.XYTextAnnotation; | |
12 import org.jfree.chart.plot.Marker; | |
13 import org.jfree.chart.plot.ValueMarker; | |
14 import org.jfree.chart.title.TextTitle; | |
15 import org.jfree.data.xy.XYSeries; | |
16 import org.jfree.ui.RectangleAnchor; | |
17 import org.jfree.ui.TextAnchor; | |
18 import org.w3c.dom.Document; | |
2 | 19 |
3 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | 20 import de.intevation.artifactdatabase.state.ArtifactAndFacet; |
4 import de.intevation.artifactdatabase.state.Facet; | 21 import de.intevation.artifactdatabase.state.Facet; |
5 import de.intevation.flys.artifacts.FLYSArtifact; | 22 import de.intevation.flys.artifacts.FLYSArtifact; |
6 import de.intevation.flys.artifacts.StaticWKmsArtifact; | 23 import de.intevation.flys.artifacts.StaticWKmsArtifact; |
12 import de.intevation.flys.artifacts.model.QWDDateRange; | 29 import de.intevation.flys.artifacts.model.QWDDateRange; |
13 import de.intevation.flys.artifacts.model.WKms; | 30 import de.intevation.flys.artifacts.model.WKms; |
14 import de.intevation.flys.artifacts.model.WQKms; | 31 import de.intevation.flys.artifacts.model.WQKms; |
15 import de.intevation.flys.artifacts.model.fixings.FixFunction; | 32 import de.intevation.flys.artifacts.model.fixings.FixFunction; |
16 import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet; | 33 import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet; |
34 import de.intevation.flys.artifacts.model.fixings.QWD; | |
17 import de.intevation.flys.artifacts.model.fixings.QWI; | 35 import de.intevation.flys.artifacts.model.fixings.QWI; |
18 import de.intevation.flys.artifacts.model.fixings.QWD; | |
19 import de.intevation.flys.artifacts.resources.Resources; | 36 import de.intevation.flys.artifacts.resources.Resources; |
20 import de.intevation.flys.exports.ChartGenerator; | 37 import de.intevation.flys.exports.ChartGenerator; |
21 import de.intevation.flys.exports.StyledSeriesBuilder; | 38 import de.intevation.flys.exports.StyledSeriesBuilder; |
22 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; | 39 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; |
23 import de.intevation.flys.jfree.FLYSAnnotation; | 40 import de.intevation.flys.jfree.FLYSAnnotation; |
24 import de.intevation.flys.jfree.JFreeUtil; | 41 import de.intevation.flys.jfree.JFreeUtil; |
25 import de.intevation.flys.jfree.StickyAxisAnnotation; | 42 import de.intevation.flys.jfree.StickyAxisAnnotation; |
26 import de.intevation.flys.jfree.StyledXYSeries; | 43 import de.intevation.flys.jfree.StyledXYSeries; |
27 import de.intevation.flys.utils.ThemeUtil; | |
28 import de.intevation.flys.utils.FLYSUtils; | |
29 | |
30 import de.intevation.flys.model.Gauge; | 44 import de.intevation.flys.model.Gauge; |
31 import de.intevation.flys.model.River; | 45 import de.intevation.flys.model.River; |
32 | 46 import de.intevation.flys.utils.FLYSUtils; |
33 import org.jfree.chart.plot.Marker; | 47 import de.intevation.flys.utils.ThemeUtil; |
34 import org.jfree.chart.plot.ValueMarker; | |
35 import org.jfree.ui.RectangleAnchor; | |
36 import org.jfree.ui.TextAnchor; | |
37 | |
38 import java.awt.BasicStroke; | |
39 import java.awt.Color; | |
40 | |
41 | |
42 import java.text.DateFormat; | |
43 import java.util.ArrayList; | |
44 import java.util.List; | |
45 | |
46 import org.apache.log4j.Logger; | |
47 import org.jfree.chart.JFreeChart; | |
48 import org.jfree.chart.annotations.XYTextAnnotation; | |
49 import org.jfree.chart.title.TextTitle; | |
50 import org.jfree.data.xy.XYSeries; | |
51 import org.w3c.dom.Document; | |
52 | 48 |
53 /** | 49 /** |
54 * Generator for WQ fixing charts. | 50 * Generator for WQ fixing charts. |
55 * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a> | 51 * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a> |
56 */ | 52 */ |
57 public class FixWQCurveGenerator | 53 public class FixWQCurveGenerator |
58 extends FixChartGenerator | 54 extends FixChartGenerator |
59 implements FacetTypes | 55 implements FacetTypes |
60 { | 56 { |
61 private static Logger logger = | 57 private static Logger logger = |
62 Logger.getLogger(FixWQCurveGenerator.class); | 58 Logger.getLogger(FixWQCurveGenerator.class); |
63 | 59 |
64 public static final String I18N_CHART_TITLE = | 60 public static final String I18N_CHART_TITLE = |
65 "chart.fixings.wq.title"; | 61 "chart.fixings.wq.title"; |
66 | 62 |
67 public static final String I18N_CHART_SUBTITLE = | 63 public static final String I18N_CHART_SUBTITLE = |
68 "chart.fixings.wq.subtitle"; | 64 "chart.fixings.wq.subtitle"; |
69 | 65 |
70 public static final String I18N_CHART_SUBTITLE1 = | 66 public static final String I18N_CHART_SUBTITLE1 = |
71 "chart.fixings.wq.subtitle1"; | 67 "chart.fixings.wq.subtitle1"; |
72 | 68 |
73 public static final String I18N_XAXIS_LABEL = | 69 public static final String I18N_XAXIS_LABEL = |
74 "chart.fixings.wq.xaxis.label"; | 70 "chart.fixings.wq.xaxis.label"; |
75 | 71 |
76 public static final String I18N_YAXIS_LABEL = | 72 public static final String I18N_YAXIS_LABEL = |
77 "chart.fixings.wq.yaxis.label"; | 73 "chart.fixings.wq.yaxis.label"; |
78 | 74 |
79 public static final String I18N_CHART_TITLE_DEFAULT = | 75 public static final String I18N_CHART_TITLE_DEFAULT = |
80 "Fixierungsanalyse"; | 76 "Fixierungsanalyse"; |
81 | 77 |
82 public static final String I18N_XAXIS_LABEL_DEFAULT = | 78 public static final String I18N_XAXIS_LABEL_DEFAULT = |
83 "Q [m\u00B3/s]"; | 79 "Q [m\u00B3/s]"; |
84 | 80 |
85 public static final String I18N_YAXIS_LABEL_DEFAULT = | 81 public static final String I18N_YAXIS_LABEL_DEFAULT = |
86 "W [NN + m]"; | 82 "W [NN + m]"; |
87 | 83 |
88 public static enum YAXIS { | 84 public static enum YAXIS { |
89 W(0), | 85 W(0), |
90 Q(1); | 86 Q(1); |
91 public int idx; | 87 public int idx; |
130 aaf.getData(context), | 126 aaf.getData(context), |
131 aaf, | 127 aaf, |
132 doc, | 128 doc, |
133 visible); | 129 visible); |
134 } | 130 } |
135 if (LONGITUDINAL_W.equals(name) || STATIC_WQ.equals(name)) { | 131 else if (LONGITUDINAL_W.equals(name) || STATIC_WQ.equals(name)) { |
136 doWQOut(aaf.getData(context), aaf, doc, visible); | 132 doWQOut(aaf.getData(context), aaf, doc, visible); |
137 } | 133 } |
138 else if (name.equals(DISCHARGE_CURVE)) { | 134 else if (name.equals(DISCHARGE_CURVE)) { |
139 doDischargeOut( | 135 doDischargeOut( |
140 (WINFOArtifact) aaf.getArtifact(), | 136 (WINFOArtifact) aaf.getArtifact(), |
141 aaf.getData(context), | 137 aaf.getData(context), |
142 aaf.getFacetDescription(), | 138 aaf.getFacetDescription(), |
143 doc, | 139 doc, |
144 visible); | 140 visible); |
141 } | |
142 else if (FacetTypes.IS.MANUALPOINTS(aaf.getFacetName())) { | |
143 doPoints(aaf.getData(context), | |
144 aaf, | |
145 doc, visible, YAXIS.W.idx); | |
145 } | 146 } |
146 else { | 147 else { |
147 logger.warn("Unknown facet name " + name); | 148 logger.warn("Unknown facet name " + name); |
148 return; | 149 return; |
149 } | 150 } |
172 if(qwd != null) { | 173 if(qwd != null) { |
173 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); | 174 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); |
174 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | 175 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); |
175 | 176 |
176 DateFormat dateFormat = DateFormat.getDateInstance( | 177 DateFormat dateFormat = DateFormat.getDateInstance( |
177 DateFormat.SHORT); | 178 DateFormat.SHORT); |
178 | 179 |
179 series.add(qwd.getQ(), qwd.getW()); | 180 series.add(qwd.getQ(), qwd.getW()); |
180 | 181 |
181 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 182 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
182 dateFormat.format(qwd.getDate()), | 183 dateFormat.format(qwd.getDate()), |
183 qwd.getQ(), | 184 qwd.getQ(), |
184 qwd.getW()); | 185 qwd.getW()); |
185 textAnnos.add(anno); | 186 textAnnos.add(anno); |
186 | 187 |
187 addAxisSeries(series, 0, visible); | 188 addAxisSeries(series, 0, visible); |
188 if(visible && ThemeUtil.parseShowPointLabel(doc)) { | 189 if(visible && ThemeUtil.parseShowPointLabel(doc)) { |
189 FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, doc); | 190 FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, doc); |
190 flysAnno.setTextAnnotations(textAnnos); | 191 flysAnno.setTextAnnotations(textAnnos); |
196 } | 197 } |
197 } | 198 } |
198 | 199 |
199 /** Add reference event points to chart */ | 200 /** Add reference event points to chart */ |
200 protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { | 201 protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { |
201 logger.debug("doReferenceEventsOut"); | 202 logger.debug("doReferenceEventsOut"); |
202 | 203 |
203 QWI qwd = (QWI)aaf.getData(context); | 204 QWI qwd = (QWI)aaf.getData(context); |
204 if(qwd != null) { | 205 if(qwd != null) { |
205 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); | 206 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc); |
206 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); | 207 List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); |
207 | 208 |
208 DateFormat dateFormat = DateFormat.getDateInstance( | 209 DateFormat dateFormat = DateFormat.getDateInstance( |
209 DateFormat.SHORT); | 210 DateFormat.SHORT); |
210 | 211 |
211 series.add(qwd.getQ(), qwd.getW()); | 212 series.add(qwd.getQ(), qwd.getW()); |
212 | 213 |
213 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 214 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
214 dateFormat.format(qwd.getDate()), | 215 dateFormat.format(qwd.getDate()), |
215 qwd.getQ(), | 216 qwd.getQ(), |
216 qwd.getW()); | 217 qwd.getW()); |
217 textAnnos.add(anno); | 218 textAnnos.add(anno); |
218 | 219 |
219 addAxisSeries(series, 0, visible); | 220 addAxisSeries(series, 0, visible); |
220 if(visible && ThemeUtil.parseShowPointLabel(doc)) { | 221 if(visible && ThemeUtil.parseShowPointLabel(doc)) { |
221 FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, doc); | 222 FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, doc); |
231 protected void doWQCurveOut(ArtifactAndFacet aaf, Document doc, boolean visible) { | 232 protected void doWQCurveOut(ArtifactAndFacet aaf, Document doc, boolean visible) { |
232 logger.debug("doWQCurveOut"); | 233 logger.debug("doWQCurveOut"); |
233 | 234 |
234 FixWQCurveFacet facet = (FixWQCurveFacet)aaf.getFacet(); | 235 FixWQCurveFacet facet = (FixWQCurveFacet)aaf.getFacet(); |
235 FixFunction func = (FixFunction)facet.getData( | 236 FixFunction func = (FixFunction)facet.getData( |
236 aaf.getArtifact(), context); | 237 aaf.getArtifact(), context); |
237 | 238 |
238 if (func == null) { | 239 if (func == null) { |
239 logger.warn("doWQCurveOut: Facet does not contain FixFunction"); | 240 logger.warn("doWQCurveOut: Facet does not contain FixFunction"); |
240 return; | 241 return; |
241 } | 242 } |
242 | 243 |
243 double maxQ = func.getMaxQ(); | 244 double maxQ = func.getMaxQ(); |
244 | 245 |
245 if (maxQ > 0) { | 246 if (maxQ > 0) { |
246 StyledXYSeries series = JFreeUtil.sampleFunction2D( | 247 StyledXYSeries series = JFreeUtil.sampleFunction2D( |
247 func.getFunction(), | 248 func.getFunction(), |
248 doc, | 249 doc, |
249 aaf.getFacetDescription(), | 250 aaf.getFacetDescription(), |
250 500, // number of samples | 251 500, // number of samples |
251 0.0 , // start | 252 0.0 , // start |
252 maxQ); // end | 253 maxQ); // end |
253 | 254 |
254 addAxisSeries(series, 0, visible); | 255 addAxisSeries(series, 0, visible); |
255 } | 256 } |
256 else { | 257 else { |
257 logger.warn("doWQCurveOut: maxQ <= 0"); | 258 logger.warn("doWQCurveOut: maxQ <= 0"); |
271 logger.debug("doQSectorOut"); | 272 logger.debug("doQSectorOut"); |
272 if (!visible) { | 273 if (!visible) { |
273 return; | 274 return; |
274 } | 275 } |
275 | 276 |
276 List<NamedDouble> qsectors = (List<NamedDouble>) aaf.getData(context); | 277 Object qsectorsObj = aaf.getData(context); |
277 | 278 if (qsectorsObj == null || !(qsectorsObj instanceof List)) { |
278 if (qsectors == null) { | |
279 logger.warn("No QSectors coming from data."); | 279 logger.warn("No QSectors coming from data."); |
280 return; | 280 return; |
281 } | 281 } |
282 | |
283 List<?> qsectorsList = (List<?>) qsectorsObj; | |
284 if (qsectorsList.size() == 0 || !(qsectorsList.get(0) instanceof NamedDouble)) { | |
285 logger.warn("No QSectors coming from data."); | |
286 return; | |
287 } | |
288 | |
289 @SuppressWarnings("unchecked") | |
290 List<NamedDouble> qsectors = (List<NamedDouble>) qsectorsList; | |
291 | |
282 for (NamedDouble qsector : qsectors) { | 292 for (NamedDouble qsector : qsectors) { |
283 if (Double.isNaN(qsector.getValue())) { | 293 if (Double.isNaN(qsector.getValue())) { |
284 continue; | 294 continue; |
285 } | 295 } |
286 Marker m = new ValueMarker(qsector.getValue()); | 296 Marker m = new ValueMarker(qsector.getValue()); |
292 if (dashes.length <= 1) { | 302 if (dashes.length <= 1) { |
293 stroke = new BasicStroke(size); | 303 stroke = new BasicStroke(size); |
294 } | 304 } |
295 else { | 305 else { |
296 stroke = new BasicStroke(size, | 306 stroke = new BasicStroke(size, |
297 BasicStroke.CAP_BUTT, | 307 BasicStroke.CAP_BUTT, |
298 BasicStroke.JOIN_ROUND, | 308 BasicStroke.JOIN_ROUND, |
299 1.0f, | 309 1.0f, |
300 dashes, | 310 dashes, |
301 0.0f); | 311 0.0f); |
302 } | 312 } |
303 m.setStroke(stroke); | 313 m.setStroke(stroke); |
304 | 314 |
305 if (ThemeUtil.parseShowLineLabel(theme)) { | 315 if (ThemeUtil.parseShowLineLabel(theme)) { |
306 m.setLabel(qsector.getName()); | 316 m.setLabel(qsector.getName()); |
322 * Add W-Annotations to plot. | 332 * Add W-Annotations to plot. |
323 * @param wqkms actual data (double[][]). | 333 * @param wqkms actual data (double[][]). |
324 * @param theme theme to use. | 334 * @param theme theme to use. |
325 */ | 335 */ |
326 protected void doWAnnotations( | 336 protected void doWAnnotations( |
327 Object wqkms, | 337 Object wqkms, |
328 ArtifactAndFacet aandf, | 338 ArtifactAndFacet aandf, |
329 Document theme, | 339 Document theme, |
330 boolean visible | 340 boolean visible |
331 ) { | 341 ) { |
332 Facet facet = aandf.getFacet(); | 342 Facet facet = aandf.getFacet(); |
333 | 343 |
334 List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); | 344 List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>(); |
335 if (wqkms instanceof double[][]) { | 345 if (wqkms instanceof double[][]) { |
336 logger.debug("Got double[][]"); | 346 logger.debug("Got double[][]"); |
337 double [][] data = (double [][]) wqkms; | 347 double [][] data = (double [][]) wqkms; |
338 for (int i = 0; i< data[0].length; i++) { | 348 for (int i = 0; i< data[0].length; i++) { |
339 xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), | 349 xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), |
340 (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS)); | 350 (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS)); |
341 } | 351 } |
342 | 352 |
343 doAnnotations(new FLYSAnnotation(facet.getDescription(), xy), | 353 doAnnotations(new FLYSAnnotation(facet.getDescription(), xy), |
344 aandf, theme, visible); | 354 aandf, theme, visible); |
345 } | 355 } |
346 else { | 356 else { |
347 // Assume its WKms. | 357 // Assume its WKms. |
348 logger.debug("Got WKms"); | 358 logger.debug("Got WKms"); |
349 WKms data = (WKms) wqkms; | 359 WKms data = (WKms) wqkms; |
350 | 360 |
351 Double ckm = (Double) context.getContextValue(CURRENT_KM); | 361 Double ckm = (Double) context.getContextValue(CURRENT_KM); |
352 double location = (ckm != null) | 362 double location = (ckm != null) |
353 ? ckm.doubleValue() | 363 ? ckm.doubleValue() |
354 : getRange()[0]; | 364 : getRange()[0]; |
355 double w = ((StaticWKmsArtifact) aandf.getArtifact()) | 365 double w = StaticWKmsArtifact.getWAtKmLin(data, location); |
356 .getWAtKmLin(data, location); | 366 xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), |
357 xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(), | 367 (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS)); |
358 (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS)); | 368 |
359 | 369 doAnnotations(new FLYSAnnotation(facet.getDescription(), xy), |
360 doAnnotations(new FLYSAnnotation(facet.getDescription(), xy), | 370 aandf, theme, visible); |
361 aandf, theme, visible); | |
362 } | 371 } |
363 } | 372 } |
364 | 373 |
365 | 374 |
366 /** | 375 /** |
367 * Add series with discharge curve to diagram. | 376 * Add series with discharge curve to diagram. |
368 */ | 377 */ |
369 protected void doDischargeOut( | 378 protected void doDischargeOut( |
370 WINFOArtifact artifact, | 379 WINFOArtifact artifact, |
371 Object o, | 380 Object o, |
372 String description, | 381 String description, |
373 Document theme, | 382 Document theme, |
374 boolean visible) | 383 boolean visible) |
375 { | 384 { |
376 WQKms wqkms = (WQKms) o; | 385 WQKms wqkms = (WQKms) o; |
377 | 386 |
378 String gaugeName = wqkms.getName(); | 387 String gaugeName = wqkms.getName(); |
379 | 388 |
390 logger.debug("no gauge found"); | 399 logger.debug("no gauge found"); |
391 return; | 400 return; |
392 } | 401 } |
393 | 402 |
394 XYSeries series = new StyledXYSeries(description, theme); | 403 XYSeries series = new StyledXYSeries(description, theme); |
395 | |
396 StyledSeriesBuilder.addPointsQW(series, wqkms); | 404 StyledSeriesBuilder.addPointsQW(series, wqkms); |
397 | |
398 addAxisSeries(series, YAXIS.W.idx, visible); | 405 addAxisSeries(series, YAXIS.W.idx, visible); |
399 } | 406 } |
400 | 407 |
401 | 408 |
402 /** | 409 /** |
403 * Add WQ Data to plot. | 410 * Add WQ Data to plot. |
404 * @param wqkms data as double[][] | 411 * @param wqkms data as double[][] |
405 */ | 412 */ |
406 protected void doWQOut( | 413 protected void doWQOut( |
407 Object wqkms, | 414 Object wqkms, |
408 ArtifactAndFacet aaf, | 415 ArtifactAndFacet aaf, |
409 Document theme, | 416 Document theme, |
410 boolean visible | 417 boolean visible |
411 ) { | 418 ) { |
412 logger.debug("FixWQCurveGenerator: doWQOut"); | 419 logger.debug("FixWQCurveGenerator: doWQOut"); |
413 if (wqkms instanceof WQKms) { | 420 if (wqkms instanceof WQKms) { |
414 WQKms data = (WQKms) wqkms; | 421 WQKms data = (WQKms) wqkms; |
415 | 422 |
416 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); | 423 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); |
417 Double ckm = (Double) context.getContextValue(CURRENT_KM); | |
418 | |
419 StyledSeriesBuilder.addPointsQW(series, data); | 424 StyledSeriesBuilder.addPointsQW(series, data); |
420 | 425 |
421 addAxisSeries(series, YAXIS.W.idx, visible); | 426 addAxisSeries(series, YAXIS.W.idx, visible); |
422 } | 427 } |
423 else { | 428 else { |
430 } | 435 } |
431 } | 436 } |
432 | 437 |
433 | 438 |
434 protected void addQWSeries( | 439 protected void addQWSeries( |
435 QWI [] qws, | 440 QWI [] qws, |
436 ArtifactAndFacet aaf, | 441 ArtifactAndFacet aaf, |
437 Document theme, | 442 Document theme, |
438 boolean visible | 443 boolean visible |
439 ) { | 444 ) { |
440 if (qws == null) { | 445 if (qws == null) { |
441 return; | 446 return; |
442 } | 447 } |
443 | 448 |
444 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); | 449 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); |
445 List<XYTextAnnotation> textAnnos = | 450 List<XYTextAnnotation> textAnnos = |
446 new ArrayList<XYTextAnnotation>(qws.length); | 451 new ArrayList<XYTextAnnotation>(qws.length); |
447 | 452 |
448 DateFormat dateFormat = DateFormat.getDateInstance( | 453 DateFormat dateFormat = DateFormat.getDateInstance( |
449 DateFormat.SHORT); | 454 DateFormat.SHORT); |
450 | 455 |
451 for (QWI qw: qws) { | 456 for (QWI qw: qws) { |
452 series.add(qw.getQ(), qw.getW()); | 457 series.add(qw.getQ(), qw.getW()); |
453 | 458 |
454 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( | 459 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( |
455 dateFormat.format(qw.getDate()), | 460 dateFormat.format(qw.getDate()), |
456 qw.getQ(), | 461 qw.getQ(), |
457 qw.getW()); | 462 qw.getW()); |
458 textAnnos.add(anno); | 463 textAnnos.add(anno); |
459 } | 464 } |
460 | 465 |
461 addAxisSeries(series, 0, visible); | 466 addAxisSeries(series, 0, visible); |
462 if (visible && ThemeUtil.parseShowPointLabel(theme)) { | 467 if (visible && ThemeUtil.parseShowPointLabel(theme)) { |
463 FLYSAnnotation flysAnno = | 468 FLYSAnnotation flysAnno = |
464 new FLYSAnnotation(null, null, null, theme); | 469 new FLYSAnnotation(null, null, null, theme); |
465 flysAnno.setTextAnnotations(textAnnos); | 470 flysAnno.setTextAnnotations(textAnnos); |
466 addAnnotations(flysAnno); | 471 addAnnotations(flysAnno); |
467 } | 472 } |
468 } | 473 } |
469 | 474 |
552 public int length() { | 557 public int length() { |
553 return YAXIS.values().length; | 558 return YAXIS.values().length; |
554 } | 559 } |
555 | 560 |
556 @Override | 561 @Override |
557 public String getId(int idx) { | 562 public String getId(int idx) { |
558 YAXIS[] yaxes = YAXIS.values(); | 563 YAXIS[] yaxes = YAXIS.values(); |
559 return yaxes[idx].toString(); | 564 return yaxes[idx].toString(); |
560 } | 565 } |
561 }; | 566 }; |
562 } | 567 } |