comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 2330:594885703687

Picked changes r4015:4026 from trunk. flys-artifacts/tags/2.6@4028 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 10 Feb 2012 11:18:27 +0000
parents 1fcaeced48f2
children 0ddebd4448a7
comparison
equal deleted inserted replaced
2329:d999062c20e6 2330:594885703687
37 import org.jfree.ui.TextAnchor; 37 import org.jfree.ui.TextAnchor;
38 38
39 import de.intevation.artifactdatabase.state.ArtifactAndFacet; 39 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
40 import de.intevation.artifactdatabase.state.Facet; 40 import de.intevation.artifactdatabase.state.Facet;
41 41
42 import de.intevation.flys.jfree.Bounds;
42 import de.intevation.flys.jfree.FLYSAnnotation; 43 import de.intevation.flys.jfree.FLYSAnnotation;
43 import de.intevation.flys.jfree.StickyAxisAnnotation; 44 import de.intevation.flys.jfree.StickyAxisAnnotation;
44 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation; 45 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation;
45 import de.intevation.flys.jfree.StyledAreaSeriesCollection; 46 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
46 import de.intevation.flys.jfree.StyledXYSeries; 47 import de.intevation.flys.jfree.StyledXYSeries;
463 zoomY(plot, yaxis, yRanges.get(Integer.valueOf(i)), yrange); 464 zoomY(plot, yaxis, yRanges.get(Integer.valueOf(i)), yrange);
464 } 465 }
465 } 466 }
466 467
467 468
469 protected Range getDomainAxisRange() {
470 String[] ranges = getDomainAxisRangeFromRequest();
471
472 if (ranges == null || ranges.length < 2) {
473 logger.debug("No zoom range for domain axis specified.");
474 return null;
475 }
476
477 if (ranges[0].length() > 0 && ranges[1].length() > 0) {
478 try {
479 double from = Double.parseDouble(ranges[0]);
480 double to = Double.parseDouble(ranges[1]);
481
482 if (from == 0 && to == 0) {
483 logger.debug("No range specified. Lower and upper X == 0");
484 return null;
485 }
486
487 if (from > to) {
488 double tmp = to;
489 to = from;
490 from = tmp;
491 }
492
493 return new Range(from, to);
494 }
495 catch (NumberFormatException nfe) {
496 logger.warn("Wrong values for domain axis range.");
497 }
498 }
499
500 return null;
501 }
502
503
504 protected Range getValueAxisRange() {
505 String[] ranges = getValueAxisRangeFromRequest();
506
507 if (ranges == null || ranges.length < 2) {
508 logger.debug("No range specified. Lower and upper Y == 0");
509 return null;
510 }
511
512 if (ranges[0].length() > 0 && ranges[1].length() > 0) {
513 try {
514 double from = Double.parseDouble(ranges[0]);
515 double to = Double.parseDouble(ranges[1]);
516
517 if (from == 0 && to == 0) {
518 logger.debug("No range specified. Lower and upper Y == 0");
519 return null;
520 }
521
522 return from > to
523 ? new Range(to, from)
524 : new Range(from, to);
525 }
526 catch (NumberFormatException nfe) {
527 logger.warn("Wrong values for value axis range.");
528 }
529 }
530
531 return null;
532 }
533
534
468 protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) { 535 protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) {
469 return zoom(plot, axis, range, x); 536 return zoom(plot, axis, range, x);
470 } 537 }
471 538
472 539
536 logger.warn("Range for y" + index + 603 logger.warn("Range for y" + index +
537 " axis not set. Using default values: 0 - 1."); 604 " axis not set. Using default values: 0 - 1.");
538 ry = new Range(0, 1); 605 ry = new Range(0, 1);
539 } 606 }
540 return new Range[] {rx, ry}; 607 return new Range[] {rx, ry};
608 }
609
610
611 @Override
612 public Bounds getXBounds(int axis) {
613 // TODO IMPLEMENT ME
614 throw new RuntimeException(
615 "XYChartGenerator.getXBounds(int) not implemented");
616 }
617
618
619 @Override
620 protected void setXBounds(int axis, Bounds bounds) {
621 // TODO IMPLEMENT ME
622 throw new RuntimeException(
623 "XYChartGenerator.setXBounds(int,Bounds) not implemented");
624 }
625
626
627 @Override
628 public Bounds getYBounds(int axis) {
629 // TODO IMPLEMENT ME
630 throw new RuntimeException(
631 "XYChartGenerator.getYBounds(int) not implemented");
632 }
633
634
635 @Override
636 protected void setYBounds(int axis, Bounds bounds) {
637 // TODO IMPLEMENT ME
638 throw new RuntimeException(
639 "XYChartGenerator.setYBounds(int,Bounds) not implemented");
541 } 640 }
542 641
543 642
544 /** Get color for hyk zones by their type (which is the name). */ 643 /** Get color for hyk zones by their type (which is the name). */
545 public Paint colorForHYKZone(String zoneName) { 644 public Paint colorForHYKZone(String zoneName) {

http://dive4elements.wald.intevation.org