changeset 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
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
diffstat 2 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Dec 27 08:50:28 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue Dec 27 09:09:42 2011 +0000
@@ -1,3 +1,9 @@
+2011-12-27  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java: Added and
+	make use of a new method createLegendLabelFont() to create unified Fonts for
+	LegendItems. This method considers the user defined size for LegendItems.
+
 2011-12-27  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Dec 27 08:50:28 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Dec 27 09:09:42 2011 +0000
@@ -692,6 +692,15 @@
     }
 
 
+    protected Font createLegendLabelFont() {
+        return new Font(
+            DEFAULT_FONT_NAME,
+            Font.PLAIN,
+            getLegendFontSize()
+        );
+    }
+
+
     /**
      * If no data is visible, draw at least empty axis.
      */
@@ -907,7 +916,7 @@
             return;
         }
 
-        int fontSize = getLegendFontSize();
+        Font labelFont = createLegendLabelFont();
 
         LegendItemCollection lic = new LegendItemCollection();
         LegendItemCollection old = plot.getFixedLegendItems();
@@ -922,7 +931,10 @@
             Color color   = themeAccess.parseLineColorField();
             int lineWidth = themeAccess.parseLineWidth();
 
-            lic.add(new LegendItem(fa.getLabel(), color));
+            LegendItem li = new LegendItem(fa.getLabel(), color);
+            li.setLabelFont(labelFont);
+
+            lic.add(li);
 
             for (XYTextAnnotation ta: fa.getAnnotations()) {
                 if(ta instanceof StickyAxisAnnotation) {
@@ -1079,6 +1091,8 @@
         LegendItemCollection lic  = new LegendItemCollection();
         LegendItemCollection anno = plot.getFixedLegendItems();
 
+        Font legendFont = createLegendLabelFont();
+
         int retidx = idx;
 
         if (isArea) {
@@ -1126,6 +1140,7 @@
 
             LegendItem legendItem = renderer.getLegendItem(idx, s);
             if (legendItem != null) {
+                legendItem.setLabelFont(legendFont);
                 lic.add(legendItem);
             }
             else {

http://dive4elements.wald.intevation.org