comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 2398:5d8d24984819

New abstract methods in ChartGenerator and moved a method from ChartGenerator to XYChartGenerator. flys-artifacts/trunk@4024 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 10 Feb 2012 10:24:33 +0000
parents cd4fb19ab892
children 4e82bcd07550
comparison
equal deleted inserted replaced
2397:c38063bf99da 2398:5d8d24984819
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;
498 499
499 return null; 500 return null;
500 } 501 }
501 502
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
503 protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) { 535 protected boolean zoomX(XYPlot plot, ValueAxis axis, Range range, Range x) {
504 return zoom(plot, axis, range, x); 536 return zoom(plot, axis, range, x);
505 } 537 }
506 538
507 539
571 logger.warn("Range for y" + index + 603 logger.warn("Range for y" + index +
572 " axis not set. Using default values: 0 - 1."); 604 " axis not set. Using default values: 0 - 1.");
573 ry = new Range(0, 1); 605 ry = new Range(0, 1);
574 } 606 }
575 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");
576 } 640 }
577 641
578 642
579 /** 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). */
580 public Paint colorForHYKZone(String zoneName) { 644 public Paint colorForHYKZone(String zoneName) {

http://dive4elements.wald.intevation.org