diff gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 629:d08b9ba148c5

Implemented logic to adjust number of bins corresponding to user input. gnv-artifacts/trunk@706 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 24 Feb 2010 14:30:52 +0000
parents c009d8df53aa
children a94ed2755480
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Tue Feb 23 15:50:15 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Wed Feb 24 14:30:52 2010 +0000
@@ -67,9 +67,11 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.Vector;
 
 import org.apache.log4j.Logger;
@@ -224,6 +226,10 @@
         int chartWidth   = 600;
         int chartHeight  = 400;
         boolean sVisible = false;
+        int binCount     = 0;
+        int binWidth     = 0;
+
+        Map requestParameter = new HashMap();
 
         // lines are always visible. if lines should be configurable we need a
         // parameter in the user interface
@@ -235,6 +241,8 @@
                 while (it.hasNext()) {
                     InputData ip      = it.next();
                     String optionName = ip.getName().trim();
+                    log.debug("FOUND [" + optionName + "] with value {"+ ip.getValue()+"}");
+                    requestParameter.put(optionName, ip.getValue());
 
                     if (optionName.equals("width")) {
                         chartWidth = Integer.parseInt(ip.getValue());
@@ -305,6 +313,13 @@
                 Object[][] data = HistogramHelper.prepareHistogramData(
                     results, parameters, measurements, dates);
 
+                PreferredLocale[] locales = callMeta.getLanguages();
+                Locale[] serverLocales    =
+                    RessourceFactory.getInstance().getLocales();
+                Locale locale             =
+                    callMeta.getPreferredLocale(serverLocales);
+                requestParameter.put("locale", locale);
+
                 int size           = data.length;
                 Chart[] histograms = new Chart[size];
 
@@ -315,7 +330,7 @@
                     ChartTheme theme   = createStyle(callContext);
 
                     histograms[i] = new DefaultHistogram(
-                        labels, data[i], theme);
+                        labels, data[i], theme, requestParameter);
                 }
 
                 ChartExportHelper.exportHistograms(

http://dive4elements.wald.intevation.org