Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 2055:3cec0575d655
Make use of user defined legend font size while chart creation.
flys-artifacts/trunk@3545 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 27 Dec 2011 09:09:42 +0000 |
parents | a653295c9ac0 |
children | 76eeb3b4358e |
comparison
equal
deleted
inserted
replaced
2054:a653295c9ac0 | 2055:3cec0575d655 |
---|---|
690 | 690 |
691 return axis; | 691 return axis; |
692 } | 692 } |
693 | 693 |
694 | 694 |
695 protected Font createLegendLabelFont() { | |
696 return new Font( | |
697 DEFAULT_FONT_NAME, | |
698 Font.PLAIN, | |
699 getLegendFontSize() | |
700 ); | |
701 } | |
702 | |
703 | |
695 /** | 704 /** |
696 * If no data is visible, draw at least empty axis. | 705 * If no data is visible, draw at least empty axis. |
697 */ | 706 */ |
698 private void recoverEmptyPlot(XYPlot plot) { | 707 private void recoverEmptyPlot(XYPlot plot) { |
699 if (plot.getRangeAxis() == null) { | 708 if (plot.getRangeAxis() == null) { |
905 if (annotations == null) { | 914 if (annotations == null) { |
906 logger.debug("No Annotations given."); | 915 logger.debug("No Annotations given."); |
907 return; | 916 return; |
908 } | 917 } |
909 | 918 |
910 int fontSize = getLegendFontSize(); | 919 Font labelFont = createLegendLabelFont(); |
911 | 920 |
912 LegendItemCollection lic = new LegendItemCollection(); | 921 LegendItemCollection lic = new LegendItemCollection(); |
913 LegendItemCollection old = plot.getFixedLegendItems(); | 922 LegendItemCollection old = plot.getFixedLegendItems(); |
914 | 923 |
915 XYItemRenderer renderer = plot.getRenderer(0); | 924 XYItemRenderer renderer = plot.getRenderer(0); |
920 ThemeAccess themeAccess = new ThemeAccess(theme); | 929 ThemeAccess themeAccess = new ThemeAccess(theme); |
921 | 930 |
922 Color color = themeAccess.parseLineColorField(); | 931 Color color = themeAccess.parseLineColorField(); |
923 int lineWidth = themeAccess.parseLineWidth(); | 932 int lineWidth = themeAccess.parseLineWidth(); |
924 | 933 |
925 lic.add(new LegendItem(fa.getLabel(), color)); | 934 LegendItem li = new LegendItem(fa.getLabel(), color); |
935 li.setLabelFont(labelFont); | |
936 | |
937 lic.add(li); | |
926 | 938 |
927 for (XYTextAnnotation ta: fa.getAnnotations()) { | 939 for (XYTextAnnotation ta: fa.getAnnotations()) { |
928 if(ta instanceof StickyAxisAnnotation) { | 940 if(ta instanceof StickyAxisAnnotation) { |
929 StickyAxisAnnotation sta = (StickyAxisAnnotation)ta; | 941 StickyAxisAnnotation sta = (StickyAxisAnnotation)ta; |
930 sta.applyTheme(themeAccess); | 942 sta.applyTheme(themeAccess); |
1077 boolean isArea | 1089 boolean isArea |
1078 ) { | 1090 ) { |
1079 LegendItemCollection lic = new LegendItemCollection(); | 1091 LegendItemCollection lic = new LegendItemCollection(); |
1080 LegendItemCollection anno = plot.getFixedLegendItems(); | 1092 LegendItemCollection anno = plot.getFixedLegendItems(); |
1081 | 1093 |
1094 Font legendFont = createLegendLabelFont(); | |
1095 | |
1082 int retidx = idx; | 1096 int retidx = idx; |
1083 | 1097 |
1084 if (isArea) { | 1098 if (isArea) { |
1085 logger.debug("Registering an 'area'renderer at idx: " + idx); | 1099 logger.debug("Registering an 'area'renderer at idx: " + idx); |
1086 StyledAreaSeriesCollection area = (StyledAreaSeriesCollection) series; | 1100 StyledAreaSeriesCollection area = (StyledAreaSeriesCollection) series; |
1124 renderer.setSeriesShapesVisible(s, true); | 1138 renderer.setSeriesShapesVisible(s, true); |
1125 } | 1139 } |
1126 | 1140 |
1127 LegendItem legendItem = renderer.getLegendItem(idx, s); | 1141 LegendItem legendItem = renderer.getLegendItem(idx, s); |
1128 if (legendItem != null) { | 1142 if (legendItem != null) { |
1143 legendItem.setLabelFont(legendFont); | |
1129 lic.add(legendItem); | 1144 lic.add(legendItem); |
1130 } | 1145 } |
1131 else { | 1146 else { |
1132 logger.warn("Could not get LegentItem for renderer: " | 1147 logger.warn("Could not get LegentItem for renderer: " |
1133 + idx + ", series-idx " + s); | 1148 + idx + ", series-idx " + s); |