Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 4434:60c728e557f4
Backed out changeset e8a4d2fd25cc
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 07 Nov 2012 12:28:50 +0100 |
parents | e8a4d2fd25cc |
children | 0eca080fc162 |
comparison
equal
deleted
inserted
replaced
4432:e8a4d2fd25cc | 4434:60c728e557f4 |
---|---|
252 * Return left most data points x value (on first axis). | 252 * Return left most data points x value (on first axis). |
253 * Shortcut, especially to be overridden in (LS) charts where | 253 * Shortcut, especially to be overridden in (LS) charts where |
254 * axis could be inverted. | 254 * axis could be inverted. |
255 */ | 255 */ |
256 protected double getLeftX() { | 256 protected double getLeftX() { |
257 // TODO if the range null... | |
258 //return (Double)getDomainAxisRange().getLowerBound(); | |
259 return (Double)getXBounds(0).getLower(); | 257 return (Double)getXBounds(0).getLower(); |
260 } | 258 } |
261 | 259 |
262 | 260 |
263 /** | 261 /** |
264 * Return right most data points x value (on first axis). | 262 * Return right most data points x value (on first axis). |
265 * Shortcut, especially to be overridden in (LS) charts where | 263 * Shortcut, especially to be overridden in (LS) charts where |
266 * axis could be inverted. | 264 * axis could be inverted. |
267 */ | 265 */ |
268 protected double getRightX() { | 266 protected double getRightX() { |
269 return (Double)getXBounds(0).getLower(); | 267 return (Double)getXBounds(0).getUpper(); |
270 //return (Double)getDomainAxisRange().getUpperBound(); | 268 } |
271 } | 269 |
272 | |
273 protected double getBottomY() { | |
274 Range zoomedRange = getValueAxisRange(); | |
275 return (zoomedRange != null) | |
276 ? zoomedRange.getLowerBound() | |
277 : (Double)getYBounds(0).getLower(); | |
278 } | |
279 | |
280 protected double getTopY() { | |
281 Range zoomedRange = getValueAxisRange(); | |
282 return (zoomedRange != null) | |
283 ? zoomedRange.getUpperBound() | |
284 : (Double)getYBounds(0).getUpper(); | |
285 } | |
286 | 270 |
287 /** Add a logo as background annotation to plot. */ | 271 /** Add a logo as background annotation to plot. */ |
288 protected void addLogo(XYPlot plot) { | 272 protected void addLogo(XYPlot plot) { |
289 // TODO getValue/DomainAxisRange, so that the current zoom level is respected | |
290 String logo = showLogo(); | 273 String logo = showLogo(); |
291 if (logo == null) { | 274 if (logo == null) { |
292 logger.debug("No logo to show chosen"); | 275 logger.debug("No logo to show chosen"); |
293 return; | 276 return; |
294 } | 277 } |
314 else { // TODO else if ... | 297 else { // TODO else if ... |
315 imageURL = XYChartGenerator.class.getResource("/images/bfg_logo.gif"); | 298 imageURL = XYChartGenerator.class.getResource("/images/bfg_logo.gif"); |
316 } | 299 } |
317 imageIcon = new ImageIcon(imageURL); | 300 imageIcon = new ImageIcon(imageURL); |
318 | 301 |
302 | |
319 double xPos = 0d, yPos = 0d; | 303 double xPos = 0d, yPos = 0d; |
320 | 304 |
321 String placeh = logoHPlace(); | 305 String placeh = logoHPlace(); |
322 String placev = logoVPlace(); | 306 String placev = logoVPlace(); |
323 | 307 |
324 if (placev == null || placev.equals("none")) { | 308 if (placev == null || placev.equals("none")) { |
325 placev = "top"; | 309 placev = "top"; |
326 } | 310 } |
327 if (placev.equals("top")) { | 311 if (placev.equals("top")) { |
328 yPos = getTopY(); | 312 yPos = (Double)getYBounds(0).getUpper(); |
329 } | 313 } |
330 else if (placev.equals("bottom")) { | 314 else if (placev.equals("bottom")) { |
331 yPos = getBottomY(); | 315 yPos = (Double)getYBounds(0).getLower(); |
332 } | 316 } |
333 else if (placev.equals("center")) { | 317 else if (placev.equals("center")) { |
334 yPos = (getTopY() + getBottomY())/2d; | 318 yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d; |
335 } | 319 } |
336 else { | 320 else { |
337 logger.debug("Unknown place-v value: " + placev); | 321 logger.debug("Unknown place-v value: " + placev); |
338 } | 322 } |
339 | 323 |
345 } | 329 } |
346 else if (placeh.equals("right")) { | 330 else if (placeh.equals("right")) { |
347 xPos = getRightX(); | 331 xPos = getRightX(); |
348 } | 332 } |
349 else if (placeh.equals("center")) { | 333 else if (placeh.equals("center")) { |
350 // TODO: Hier noch | |
351 xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d; | 334 xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d; |
352 // ->->-> (getDomainAxisRange().getUpperBound() + getDomainAxisRange().getLowerBound())/2d; | |
353 } | 335 } |
354 else { | 336 else { |
355 logger.debug("Unknown place-h value: " + placeh); | 337 logger.debug("Unknown place-h value: " + placeh); |
356 } | 338 } |
357 | 339 |
701 zoomY(plot, yaxis, getYBounds(Integer.valueOf(i)), yrange); | 683 zoomY(plot, yaxis, getYBounds(Integer.valueOf(i)), yrange); |
702 } | 684 } |
703 } | 685 } |
704 | 686 |
705 | 687 |
706 /** Return range of domain axis. */ | |
707 protected Range getDomainAxisRange() { | 688 protected Range getDomainAxisRange() { |
708 String[] ranges = getDomainAxisRangeFromRequest(); | 689 String[] ranges = getDomainAxisRangeFromRequest(); |
709 | 690 |
710 if (ranges == null || ranges.length < 2) { | 691 if (ranges == null || ranges.length < 2) { |
711 logger.debug("No zoom range for domain axis specified."); | 692 logger.debug("No zoom range for domain axis specified."); |
741 | 722 |
742 protected Range getValueAxisRange() { | 723 protected Range getValueAxisRange() { |
743 String[] ranges = getValueAxisRangeFromRequest(); | 724 String[] ranges = getValueAxisRangeFromRequest(); |
744 | 725 |
745 if (ranges == null || ranges.length < 2) { | 726 if (ranges == null || ranges.length < 2) { |
746 logger.warn("No range (or not enogh) specified."); | 727 logger.debug("No range specified. Lower and upper Y == 0"); |
747 if (ranges == null) logger.warn("ranges is null here"); | |
748 else logger.warn("ranges has just one element."); | |
749 return null; | 728 return null; |
750 } | 729 } |
751 | 730 |
752 if (ranges[0].length() > 0 && ranges[1].length() > 0) { | 731 if (ranges[0].length() > 0 && ranges[1].length() > 0) { |
753 try { | 732 try { |
766 catch (NumberFormatException nfe) { | 745 catch (NumberFormatException nfe) { |
767 logger.warn("Wrong values for value axis range."); | 746 logger.warn("Wrong values for value axis range."); |
768 } | 747 } |
769 } | 748 } |
770 | 749 |
771 logger.warn("One of the range elements is zero length text."); | |
772 return null; | 750 return null; |
773 } | 751 } |
774 | 752 |
775 | 753 |
776 protected boolean zoomX(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) { | 754 protected boolean zoomX(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) { |
1054 | 1032 |
1055 // WQ.java holds example of using regex Matcher/Pattern. | 1033 // WQ.java holds example of using regex Matcher/Pattern. |
1056 | 1034 |
1057 return hash; | 1035 return hash; |
1058 } | 1036 } |
1037 | |
1059 } | 1038 } |
1060 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 1039 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |