Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramGenerator.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | 8ad0b7bc3e73 |
children | 2f7f9ced46a5 |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
96 */ | 96 */ |
97 public class DiagramGenerator extends ChartGenerator2 { | 97 public class DiagramGenerator extends ChartGenerator2 { |
98 | 98 |
99 public static final int AXIS_SPACE = 5; | 99 public static final int AXIS_SPACE = 5; |
100 | 100 |
101 /** The logger that is used in this generator. */ | 101 /** The log that is used in this generator. */ |
102 private static Logger logger = Logger.getLogger(DiagramGenerator.class); | 102 private static Logger log = Logger.getLogger(DiagramGenerator.class); |
103 | 103 |
104 protected List<Marker> domainMarkers = new ArrayList<Marker>(); | 104 protected List<Marker> domainMarkers = new ArrayList<Marker>(); |
105 | 105 |
106 protected List<Marker> valueMarkers = new ArrayList<Marker>(); | 106 protected List<Marker> valueMarkers = new ArrayList<Marker>(); |
107 | 107 |
134 | 134 |
135 @Override | 135 @Override |
136 public void setup(Object config) { | 136 public void setup(Object config) { |
137 | 137 |
138 if (!(config instanceof DiagramAttributes)) { | 138 if (!(config instanceof DiagramAttributes)) { |
139 logger.error("invalid config type"); | 139 log.error("invalid config type"); |
140 return; | 140 return; |
141 } | 141 } |
142 DiagramAttributes da = (DiagramAttributes)config; | 142 DiagramAttributes da = (DiagramAttributes)config; |
143 diagramAttributes = da.new Instance(); | 143 diagramAttributes = da.new Instance(); |
144 } | 144 } |
160 diagramAttributes.getDomainAxis(); | 160 diagramAttributes.getDomainAxis(); |
161 | 161 |
162 if (dx != null) { | 162 if (dx != null) { |
163 inverted = (Boolean)dx.isInverted() | 163 inverted = (Boolean)dx.isInverted() |
164 .evaluate((D4EArtifact)getMaster(), context); | 164 .evaluate((D4EArtifact)getMaster(), context); |
165 logger.debug("setInvertedFromConfig: " + inverted); | 165 log.debug("setInvertedFromConfig: " + inverted); |
166 } else { | 166 } else { |
167 logger.debug("setInvertedFromConfig no domain axis found?"); | 167 log.debug("setInvertedFromConfig no domain axis found?"); |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 /** | 171 /** |
172 * Generate the chart anew (including localized axis and all). | 172 * Generate the chart anew (including localized axis and all). |
173 */ | 173 */ |
174 @Override | 174 @Override |
175 public JFreeChart generateChart() { | 175 public JFreeChart generateChart() { |
176 logger.debug("DiagramGenerator.generateChart"); | 176 log.debug("DiagramGenerator.generateChart"); |
177 | 177 |
178 JFreeChart chart = ChartFactory.createXYLineChart( | 178 JFreeChart chart = ChartFactory.createXYLineChart( |
179 getChartTitle(), | 179 getChartTitle(), |
180 "", | 180 "", |
181 "", | 181 "", |
263 | 263 |
264 /** Add a logo as background annotation to plot. */ | 264 /** Add a logo as background annotation to plot. */ |
265 protected void addLogo(XYPlot plot) { | 265 protected void addLogo(XYPlot plot) { |
266 String logo = showLogo(); | 266 String logo = showLogo(); |
267 if (logo == null) { | 267 if (logo == null) { |
268 logger.debug("No logo to show chosen"); | 268 log.debug("No logo to show chosen"); |
269 return; | 269 return; |
270 } | 270 } |
271 | 271 |
272 ImageIcon imageIcon = null; | 272 ImageIcon imageIcon = null; |
273 if (logo.equals("none")) { | 273 if (logo.equals("none")) { |
309 } | 309 } |
310 else if (placev.equals("center")) { | 310 else if (placev.equals("center")) { |
311 yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d; | 311 yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d; |
312 } | 312 } |
313 else { | 313 else { |
314 logger.debug("Unknown place-v value: " + placev); | 314 log.debug("Unknown place-v value: " + placev); |
315 } | 315 } |
316 | 316 |
317 if (placeh == null || placeh.equals("none")) { | 317 if (placeh == null || placeh.equals("none")) { |
318 placeh = "center"; | 318 placeh = "center"; |
319 } | 319 } |
325 } | 325 } |
326 else if (placeh.equals("center")) { | 326 else if (placeh.equals("center")) { |
327 xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d; | 327 xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d; |
328 } | 328 } |
329 else { | 329 else { |
330 logger.debug("Unknown place-h value: " + placeh); | 330 log.debug("Unknown place-h value: " + placeh); |
331 } | 331 } |
332 | 332 |
333 logger.debug("logo position: " + xPos + "/" + yPos); | 333 log.debug("logo position: " + xPos + "/" + yPos); |
334 | 334 |
335 org.jfree.ui.RectangleAnchor anchor | 335 org.jfree.ui.RectangleAnchor anchor |
336 = org.jfree.ui.RectangleAnchor.TOP; | 336 = org.jfree.ui.RectangleAnchor.TOP; |
337 if (placev.equals("top")) { | 337 if (placev.equals("top")) { |
338 if (placeh.equals("left")) { | 338 if (placeh.equals("left")) { |
394 } | 394 } |
395 | 395 |
396 | 396 |
397 @Override | 397 @Override |
398 protected AxisDataset createAxisDataset(int idx) { | 398 protected AxisDataset createAxisDataset(int idx) { |
399 logger.debug("Create new AxisDataset for index: " + idx); | 399 log.debug("Create new AxisDataset for index: " + idx); |
400 return new AxisDataset(idx); | 400 return new AxisDataset(idx); |
401 } | 401 } |
402 | 402 |
403 | 403 |
404 /** | 404 /** |
405 * Put debug output about datasets. | 405 * Put debug output about datasets. |
406 */ | 406 */ |
407 public void debugDatasets(XYPlot plot) { | 407 public void debugDatasets(XYPlot plot) { |
408 logger.debug("Number of datasets: " + plot.getDatasetCount()); | 408 log.debug("Number of datasets: " + plot.getDatasetCount()); |
409 for (int i = 0, P = plot.getDatasetCount(); i < P; i++) { | 409 for (int i = 0, P = plot.getDatasetCount(); i < P; i++) { |
410 if (plot.getDataset(i) == null) { | 410 if (plot.getDataset(i) == null) { |
411 logger.debug("Dataset #" + i + " is null"); | 411 log.debug("Dataset #" + i + " is null"); |
412 continue; | 412 continue; |
413 } | 413 } |
414 logger.debug("Dataset #" + i + ":" + plot.getDataset(i)); | 414 log.debug("Dataset #" + i + ":" + plot.getDataset(i)); |
415 XYSeriesCollection series = (XYSeriesCollection) plot.getDataset(i); | 415 XYSeriesCollection series = (XYSeriesCollection) plot.getDataset(i); |
416 logger.debug("X-Extend of Dataset: " + series.getSeries(0).getMinX() | 416 log.debug("X-Extend of Dataset: " + series.getSeries(0).getMinX() |
417 + " " + series.getSeries(0).getMaxX()); | 417 + " " + series.getSeries(0).getMaxX()); |
418 logger.debug("Y-Extend of Dataset: " + series.getSeries(0).getMinY() | 418 log.debug("Y-Extend of Dataset: " + series.getSeries(0).getMinY() |
419 + " " + series.getSeries(0).getMaxY()); | 419 + " " + series.getSeries(0).getMaxY()); |
420 } | 420 } |
421 } | 421 } |
422 | 422 |
423 | 423 |
424 /** | 424 /** |
425 * Put debug output about axes. | 425 * Put debug output about axes. |
426 */ | 426 */ |
427 public void debugAxis(XYPlot plot) { | 427 public void debugAxis(XYPlot plot) { |
428 logger.debug("..............."); | 428 log.debug("..............."); |
429 for (int i = 0, P = plot.getRangeAxisCount(); i < P; i++) { | 429 for (int i = 0, P = plot.getRangeAxisCount(); i < P; i++) { |
430 if (plot.getRangeAxis(i) == null) | 430 if (plot.getRangeAxis(i) == null) |
431 logger.debug("Range-Axis #" + i + " == null"); | 431 log.debug("Range-Axis #" + i + " == null"); |
432 else { | 432 else { |
433 logger.debug("Range-Axis " + i + " != null [" + | 433 log.debug("Range-Axis " + i + " != null [" + |
434 plot.getRangeAxis(i).getRange().getLowerBound() + | 434 plot.getRangeAxis(i).getRange().getLowerBound() + |
435 " " + plot.getRangeAxis(i).getRange().getUpperBound() + | 435 " " + plot.getRangeAxis(i).getRange().getUpperBound() + |
436 "]"); | 436 "]"); |
437 } | 437 } |
438 } | 438 } |
439 for (int i = 0, P = plot.getDomainAxisCount(); i < P; i++) { | 439 for (int i = 0, P = plot.getDomainAxisCount(); i < P; i++) { |
440 if (plot.getDomainAxis(i) == null) | 440 if (plot.getDomainAxis(i) == null) |
441 logger.debug("Domain-Axis #" + i + " == null"); | 441 log.debug("Domain-Axis #" + i + " == null"); |
442 else { | 442 else { |
443 logger.debug("Domain-Axis " + i + " != null [" + | 443 log.debug("Domain-Axis " + i + " != null [" + |
444 plot.getDomainAxis(i).getRange().getLowerBound() + | 444 plot.getDomainAxis(i).getRange().getLowerBound() + |
445 " " + plot.getDomainAxis(i).getRange().getUpperBound() + | 445 " " + plot.getDomainAxis(i).getRange().getUpperBound() + |
446 "]"); | 446 "]"); |
447 } | 447 } |
448 } | 448 } |
449 logger.debug("..............."); | 449 log.debug("..............."); |
450 } | 450 } |
451 | 451 |
452 /** | 452 /** |
453 * Registers an area to be drawn. | 453 * Registers an area to be drawn. |
454 * @param area Area to be drawn. | 454 * @param area Area to be drawn. |
465 * @param index 'axis index' | 465 * @param index 'axis index' |
466 * @param visible Whether or not to be visible (important for range calculations). | 466 * @param visible Whether or not to be visible (important for range calculations). |
467 */ | 467 */ |
468 public void addAreaSeries(StyledAreaSeriesCollection area, int index, boolean visible) { | 468 public void addAreaSeries(StyledAreaSeriesCollection area, int index, boolean visible) { |
469 if (area == null) { | 469 if (area == null) { |
470 logger.warn("Cannot yet render above/under curve."); | 470 log.warn("Cannot yet render above/under curve."); |
471 return; | 471 return; |
472 } | 472 } |
473 | 473 |
474 AxisDataset axisDataset = (AxisDataset) getAxisDataset(index); | 474 AxisDataset axisDataset = (AxisDataset) getAxisDataset(index); |
475 | 475 |
492 public void addAxisSeries(XYSeries series, int index, boolean visible) { | 492 public void addAxisSeries(XYSeries series, int index, boolean visible) { |
493 if (series == null) { | 493 if (series == null) { |
494 return; | 494 return; |
495 } | 495 } |
496 | 496 |
497 logger.debug("Y Range of XYSeries: " + | 497 log.debug("Y Range of XYSeries: " + |
498 series.getMinY() + " | " + series.getMaxY()); | 498 series.getMinY() + " | " + series.getMaxY()); |
499 | 499 |
500 addAxisDataset(new XYMetaSeriesCollection(series), index, visible); | 500 addAxisDataset(new XYMetaSeriesCollection(series), index, visible); |
501 } | 501 } |
502 | 502 |
574 * @param index index of axis to be merged. | 574 * @param index index of axis to be merged. |
575 */ | 575 */ |
576 @Override | 576 @Override |
577 protected void combineXBounds(Bounds bounds, int index) { | 577 protected void combineXBounds(Bounds bounds, int index) { |
578 if (!(bounds instanceof DoubleBounds)) { | 578 if (!(bounds instanceof DoubleBounds)) { |
579 logger.warn("Unsupported Bounds type: " + bounds.getClass()); | 579 log.warn("Unsupported Bounds type: " + bounds.getClass()); |
580 return; | 580 return; |
581 } | 581 } |
582 | 582 |
583 DoubleBounds dBounds = (DoubleBounds) bounds; | 583 DoubleBounds dBounds = (DoubleBounds) bounds; |
584 | 584 |
599 | 599 |
600 | 600 |
601 @Override | 601 @Override |
602 protected void combineYBounds(Bounds bounds, int index) { | 602 protected void combineYBounds(Bounds bounds, int index) { |
603 if (!(bounds instanceof DoubleBounds)) { | 603 if (!(bounds instanceof DoubleBounds)) { |
604 logger.warn("Unsupported Bounds type: " + bounds.getClass()); | 604 log.warn("Unsupported Bounds type: " + bounds.getClass()); |
605 return; | 605 return; |
606 } | 606 } |
607 | 607 |
608 DoubleBounds dBounds = (DoubleBounds) bounds; | 608 DoubleBounds dBounds = (DoubleBounds) bounds; |
609 | 609 |
626 /** | 626 /** |
627 * If no data is visible, draw at least empty axis. | 627 * If no data is visible, draw at least empty axis. |
628 */ | 628 */ |
629 private void recoverEmptyPlot(XYPlot plot) { | 629 private void recoverEmptyPlot(XYPlot plot) { |
630 if (plot.getRangeAxis() == null) { | 630 if (plot.getRangeAxis() == null) { |
631 logger.debug("debug: No range axis"); | 631 log.debug("debug: No range axis"); |
632 plot.setRangeAxis(createYAxis(0)); | 632 plot.setRangeAxis(createYAxis(0)); |
633 } | 633 } |
634 } | 634 } |
635 | 635 |
636 | 636 |
643 Integer key = Integer.valueOf(i); | 643 Integer key = Integer.valueOf(i); |
644 Bounds b = getXBounds(key); | 644 Bounds b = getXBounds(key); |
645 | 645 |
646 | 646 |
647 if (b != null && b.getLower().equals(b.getUpper())) { | 647 if (b != null && b.getLower().equals(b.getUpper())) { |
648 logger.debug("Check whether to expand a x axis.i ("+b.getLower() + "-" + b.getUpper()+")"); | 648 log.debug("Check whether to expand a x axis.i ("+b.getLower() + "-" + b.getUpper()+")"); |
649 setXBounds(key, ChartHelper.expandBounds(b, 5)); | 649 setXBounds(key, ChartHelper.expandBounds(b, 5)); |
650 } | 650 } |
651 } | 651 } |
652 } | 652 } |
653 | 653 |
660 * right of the data area. | 660 * right of the data area. |
661 * | 661 * |
662 * @param plot The XYPlot. | 662 * @param plot The XYPlot. |
663 */ | 663 */ |
664 protected void autoZoom(XYPlot plot) { | 664 protected void autoZoom(XYPlot plot) { |
665 logger.debug("Zoom to specified ranges."); | 665 log.debug("Zoom to specified ranges."); |
666 | 666 |
667 Range xrange = getDomainAxisRange(); | 667 Range xrange = getDomainAxisRange(); |
668 Range yrange = getValueAxisRange(); | 668 Range yrange = getValueAxisRange(); |
669 | 669 |
670 ValueAxis xAxis = plot.getDomainAxis(); | 670 ValueAxis xAxis = plot.getDomainAxis(); |
689 continue; | 689 continue; |
690 } | 690 } |
691 } | 691 } |
692 | 692 |
693 if (yaxis == null) { | 693 if (yaxis == null) { |
694 logger.debug("Zoom problem: no Y Axis for index: " + i); | 694 log.debug("Zoom problem: no Y Axis for index: " + i); |
695 continue; | 695 continue; |
696 } | 696 } |
697 | 697 |
698 logger.debug("Prepare zoom settings for y axis at index: " + i); | 698 log.debug("Prepare zoom settings for y axis at index: " + i); |
699 zoomY(plot, yaxis, getYBounds(Integer.valueOf(i)), yrange); | 699 zoomY(plot, yaxis, getYBounds(Integer.valueOf(i)), yrange); |
700 } | 700 } |
701 } | 701 } |
702 | 702 |
703 | 703 |
704 protected Range getDomainAxisRange() { | 704 protected Range getDomainAxisRange() { |
705 String[] ranges = getDomainAxisRangeFromRequest(); | 705 String[] ranges = getDomainAxisRangeFromRequest(); |
706 | 706 |
707 if (ranges == null || ranges.length < 2) { | 707 if (ranges == null || ranges.length < 2) { |
708 logger.debug("No zoom range for domain axis specified."); | 708 log.debug("No zoom range for domain axis specified."); |
709 return null; | 709 return null; |
710 } | 710 } |
711 | 711 |
712 if (ranges[0].length() > 0 && ranges[1].length() > 0) { | 712 if (ranges[0].length() > 0 && ranges[1].length() > 0) { |
713 try { | 713 try { |
714 double from = Double.parseDouble(ranges[0]); | 714 double from = Double.parseDouble(ranges[0]); |
715 double to = Double.parseDouble(ranges[1]); | 715 double to = Double.parseDouble(ranges[1]); |
716 | 716 |
717 if (from == 0 && to == 0) { | 717 if (from == 0 && to == 0) { |
718 logger.debug("No range specified. Lower and upper X == 0"); | 718 log.debug("No range specified. Lower and upper X == 0"); |
719 return null; | 719 return null; |
720 } | 720 } |
721 | 721 |
722 if (from > to) { | 722 if (from > to) { |
723 double tmp = to; | 723 double tmp = to; |
726 } | 726 } |
727 | 727 |
728 return new Range(from, to); | 728 return new Range(from, to); |
729 } | 729 } |
730 catch (NumberFormatException nfe) { | 730 catch (NumberFormatException nfe) { |
731 logger.warn("Wrong values for domain axis range."); | 731 log.warn("Wrong values for domain axis range."); |
732 } | 732 } |
733 } | 733 } |
734 | 734 |
735 return null; | 735 return null; |
736 } | 736 } |
738 | 738 |
739 protected Range getValueAxisRange() { | 739 protected Range getValueAxisRange() { |
740 String[] ranges = getValueAxisRangeFromRequest(); | 740 String[] ranges = getValueAxisRangeFromRequest(); |
741 | 741 |
742 if (ranges == null || ranges.length < 2) { | 742 if (ranges == null || ranges.length < 2) { |
743 logger.debug("No range specified. Lower and upper Y == 0"); | 743 log.debug("No range specified. Lower and upper Y == 0"); |
744 return null; | 744 return null; |
745 } | 745 } |
746 | 746 |
747 if (ranges[0].length() > 0 && ranges[1].length() > 0) { | 747 if (ranges[0].length() > 0 && ranges[1].length() > 0) { |
748 try { | 748 try { |
749 double from = Double.parseDouble(ranges[0]); | 749 double from = Double.parseDouble(ranges[0]); |
750 double to = Double.parseDouble(ranges[1]); | 750 double to = Double.parseDouble(ranges[1]); |
751 | 751 |
752 if (from == 0 && to == 0) { | 752 if (from == 0 && to == 0) { |
753 logger.debug("No range specified. Lower and upper Y == 0"); | 753 log.debug("No range specified. Lower and upper Y == 0"); |
754 return null; | 754 return null; |
755 } | 755 } |
756 | 756 |
757 return from > to | 757 return from > to |
758 ? new Range(to, from) | 758 ? new Range(to, from) |
759 : new Range(from, to); | 759 : new Range(from, to); |
760 } | 760 } |
761 catch (NumberFormatException nfe) { | 761 catch (NumberFormatException nfe) { |
762 logger.warn("Wrong values for value axis range."); | 762 log.warn("Wrong values for value axis range."); |
763 } | 763 } |
764 } | 764 } |
765 | 765 |
766 return null; | 766 return null; |
767 } | 767 } |
795 | 795 |
796 if (x != null) { | 796 if (x != null) { |
797 Bounds computed = calculateZoom(bounds, x); | 797 Bounds computed = calculateZoom(bounds, x); |
798 computed.applyBounds(axis, AXIS_SPACE); | 798 computed.applyBounds(axis, AXIS_SPACE); |
799 | 799 |
800 logger.debug("Zoom axis to: " + computed); | 800 log.debug("Zoom axis to: " + computed); |
801 | 801 |
802 return true; | 802 return true; |
803 } | 803 } |
804 | 804 |
805 bounds.applyBounds(axis, AXIS_SPACE); | 805 bounds.applyBounds(axis, AXIS_SPACE); |
815 */ | 815 */ |
816 protected Bounds calculateZoom(Bounds bounds, Range range) { | 816 protected Bounds calculateZoom(Bounds bounds, Range range) { |
817 double min = bounds.getLower().doubleValue(); | 817 double min = bounds.getLower().doubleValue(); |
818 double max = bounds.getUpper().doubleValue(); | 818 double max = bounds.getUpper().doubleValue(); |
819 | 819 |
820 if (logger.isDebugEnabled()) { | 820 if (log.isDebugEnabled()) { |
821 logger.debug("Minimum is: " + min); | 821 log.debug("Minimum is: " + min); |
822 logger.debug("Maximum is: " + max); | 822 log.debug("Maximum is: " + max); |
823 logger.debug("Lower zoom is: " + range.getLowerBound()); | 823 log.debug("Lower zoom is: " + range.getLowerBound()); |
824 logger.debug("Upper zoom is: " + range.getUpperBound()); | 824 log.debug("Upper zoom is: " + range.getUpperBound()); |
825 } | 825 } |
826 | 826 |
827 double diff = max > min ? max - min : min - max; | 827 double diff = max > min ? max - min : min - max; |
828 | 828 |
829 DoubleBounds computed = new DoubleBounds( | 829 DoubleBounds computed = new DoubleBounds( |
840 * | 840 * |
841 * @return a Range[] as follows: [x-Range, y-Range]. | 841 * @return a Range[] as follows: [x-Range, y-Range]. |
842 */ | 842 */ |
843 @Override | 843 @Override |
844 public Range[] getRangesForAxis(int index) { | 844 public Range[] getRangesForAxis(int index) { |
845 logger.debug("getRangesForAxis " + index); | 845 log.debug("getRangesForAxis " + index); |
846 | 846 |
847 Bounds rx = getXBounds(Integer.valueOf(0)); | 847 Bounds rx = getXBounds(Integer.valueOf(0)); |
848 Bounds ry = getYBounds(Integer.valueOf(index)); | 848 Bounds ry = getYBounds(Integer.valueOf(index)); |
849 | 849 |
850 if (rx == null) { | 850 if (rx == null) { |
851 logger.warn("Range for x axis not set." + | 851 log.warn("Range for x axis not set." + |
852 " Using default values: 0 - 1."); | 852 " Using default values: 0 - 1."); |
853 rx = new DoubleBounds(0, 1); | 853 rx = new DoubleBounds(0, 1); |
854 } | 854 } |
855 if (ry == null) { | 855 if (ry == null) { |
856 logger.warn("Range for y" + index + | 856 log.warn("Range for y" + index + |
857 " axis not set. Using default values: 0 - 1."); | 857 " axis not set. Using default values: 0 - 1."); |
858 ry = new DoubleBounds(0, 1); | 858 ry = new DoubleBounds(0, 1); |
859 } | 859 } |
860 | 860 |
861 return new Range[] { | 861 return new Range[] { |
920 getXAxisLabelFontSize()); | 920 getXAxisLabelFontSize()); |
921 | 921 |
922 xaxis.setLabelFont(labelFont); | 922 xaxis.setLabelFont(labelFont); |
923 xaxis.setTickLabelFont(labelFont); | 923 xaxis.setTickLabelFont(labelFont); |
924 | 924 |
925 logger.debug("Adjusting xAxis. Inverted?: " + inverted); | 925 log.debug("Adjusting xAxis. Inverted?: " + inverted); |
926 if (inverted) { | 926 if (inverted) { |
927 xaxis.setInverted(true); | 927 xaxis.setInverted(true); |
928 } | 928 } |
929 } | 929 } |
930 | 930 |
942 | 942 |
943 if (axis != null) { | 943 if (axis != null) { |
944 localizeDomainAxis(axis); | 944 localizeDomainAxis(axis); |
945 } | 945 } |
946 else { | 946 else { |
947 logger.warn("Domain axis at " + i + " is null."); | 947 log.warn("Domain axis at " + i + " is null."); |
948 } | 948 } |
949 } | 949 } |
950 | 950 |
951 for (int i = 0, num = plot.getRangeAxisCount(); i < num; i++) { | 951 for (int i = 0, num = plot.getRangeAxisCount(); i < num; i++) { |
952 ValueAxis axis = plot.getRangeAxis(i); | 952 ValueAxis axis = plot.getRangeAxis(i); |
953 | 953 |
954 if (axis != null) { | 954 if (axis != null) { |
955 localizeRangeAxis(axis); | 955 localizeRangeAxis(axis); |
956 } | 956 } |
957 else { | 957 else { |
958 logger.warn("Range axis at " + i + " is null."); | 958 log.warn("Range axis at " + i + " is null."); |
959 } | 959 } |
960 } | 960 } |
961 } | 961 } |
962 | 962 |
963 | 963 |
1092 } | 1092 } |
1093 | 1093 |
1094 @Override | 1094 @Override |
1095 protected String getDefaultYAxisLabel(String axisName) { | 1095 protected String getDefaultYAxisLabel(String axisName) { |
1096 Set labelSet = axesLabels.get(diagramAttributes.getAxisIndex(axisName)); | 1096 Set labelSet = axesLabels.get(diagramAttributes.getAxisIndex(axisName)); |
1097 logger.debug("Labels for axis: " + labelSet); | 1097 log.debug("Labels for axis: " + labelSet); |
1098 if (labelSet != null && !labelSet.isEmpty()) { | 1098 if (labelSet != null && !labelSet.isEmpty()) { |
1099 String label = StringUtils.join(labelSet, ", "); | 1099 String label = StringUtils.join(labelSet, ", "); |
1100 Matcher units = UNIT_PATTERN.matcher(label); | 1100 Matcher units = UNIT_PATTERN.matcher(label); |
1101 if (units.find()) { | 1101 if (units.find()) { |
1102 String firstUnit = units.group(); | 1102 String firstUnit = units.group(); |
1192 Facet facet = bundle.getFacet(); | 1192 Facet facet = bundle.getFacet(); |
1193 | 1193 |
1194 /* A conservative security check */ | 1194 /* A conservative security check */ |
1195 if (facetName == null || facet == null) { | 1195 if (facetName == null || facet == null) { |
1196 /* Can't happen,.. */ | 1196 /* Can't happen,.. */ |
1197 logger.error("doOut called with null facet."); | 1197 log.error("doOut called with null facet."); |
1198 return; | 1198 return; |
1199 } | 1199 } |
1200 | 1200 |
1201 logger.debug("DoOut for facet: " + facetName); | 1201 log.debug("DoOut for facet: " + facetName); |
1202 | 1202 |
1203 boolean found = false; | 1203 boolean found = false; |
1204 List<Processor> prL = diagramAttributes.getProcessors(); | 1204 List<Processor> prL = diagramAttributes.getProcessors(); |
1205 for (Processor pr: prL) { | 1205 for (Processor pr: prL) { |
1206 if (pr.canHandle(facetName)) { | 1206 if (pr.canHandle(facetName)) { |
1218 axesLabels.put(axisIdx, curLabels); | 1218 axesLabels.put(axisIdx, curLabels); |
1219 } | 1219 } |
1220 } | 1220 } |
1221 } | 1221 } |
1222 if (!found) { | 1222 if (!found) { |
1223 logger.warn("No processor found for: " + facetName); | 1223 log.warn("No processor found for: " + facetName); |
1224 if (logger.isDebugEnabled()) { | 1224 if (log.isDebugEnabled()) { |
1225 logger.debug("Configured processors for this diagram are:"); | 1225 log.debug("Configured processors for this diagram are:"); |
1226 for (Processor pr: prL) { | 1226 for (Processor pr: prL) { |
1227 logger.debug(pr.getClass().getName()); | 1227 log.debug(pr.getClass().getName()); |
1228 } | 1228 } |
1229 } | 1229 } |
1230 } | 1230 } |
1231 } | 1231 } |
1232 | 1232 |