comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java @ 8338:ac7cb15e1946

Scale second W-axis in cm according to first axis, which is expanded relative to the data, and set bounds for zooming purposes (plus a bit of cleanup in DiagramGenerator).
author "Tom Gottfried <tom@intevation.de>"
date Fri, 26 Sep 2014 18:23:45 +0200
parents 2f7f9ced46a5
children 130160b8d245
comparison
equal deleted inserted replaced
8337:f5461750e5c7 8338:ac7cb15e1946
669 Range fixedXRange = getRangeForAxisFromSettings("X"); 669 Range fixedXRange = getRangeForAxisFromSettings("X");
670 if (fixedXRange != null) { 670 if (fixedXRange != null) {
671 xAxis.setRange(fixedXRange); 671 xAxis.setRange(fixedXRange);
672 } 672 }
673 else { 673 else {
674 zoomX(plot, xAxis, getXBounds(0), xrange); 674 zoom(plot, xAxis, getXBounds(0), xrange);
675 } 675 }
676 676
677 for (int i = 0, num = plot.getRangeAxisCount(); i < num; i++) { 677 for (int i = 0, num = plot.getRangeAxisCount(); i < num; i++) {
678 ValueAxis yaxis = plot.getRangeAxis(i); 678 ValueAxis yaxis = plot.getRangeAxis(i);
679 679
691 log.debug("Zoom problem: no Y Axis for index: " + i); 691 log.debug("Zoom problem: no Y Axis for index: " + i);
692 continue; 692 continue;
693 } 693 }
694 694
695 log.debug("Prepare zoom settings for y axis at index: " + i); 695 log.debug("Prepare zoom settings for y axis at index: " + i);
696 zoomY(plot, yaxis, getYBounds(Integer.valueOf(i)), yrange); 696 zoom(plot, yaxis, getYBounds(Integer.valueOf(i)), yrange);
697 } 697 }
698 } 698 }
699 699
700 700
701 protected Range getDomainAxisRange() { 701 protected Range getDomainAxisRange() {
762 762
763 return null; 763 return null;
764 } 764 }
765 765
766 766
767 protected boolean zoomX(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) { 767 /**
768 return zoom(plot, axis, bounds, x); 768 * Zooms the axis to the range specified in the attribute document.
769 } 769 *
770 770 * @param plot The XYPlot.
771 771 * @param axis The axis that should be modified.
772 protected boolean zoomY(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) {
773 return zoom(plot, axis, bounds, x);
774 }
775
776
777 /**
778 * Zooms the x axis to the range specified in the attribute document.
779 *
780 * @param plot The XYPlot.
781 * @param axis The axis the shoud be modified.
782 * @param bounds The whole range specified by a dataset. 772 * @param bounds The whole range specified by a dataset.
783 * @param x A user defined range (null permitted). 773 * @param x A user defined range (null permitted).
784 * 774 *
785 * @return true, if a zoom range was specified, otherwise false. 775 * @return true, if a zoom range was specified, otherwise false.
786 */ 776 */
787 protected boolean zoom(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) { 777 protected boolean zoom(XYPlot plot, ValueAxis axis, Bounds bounds, Range x) {
788 778

http://dive4elements.wald.intevation.org