# HG changeset patch # User Ingo Weinzierl # Date 1274893289 0 # Node ID 8430269ec73bfb6b96a423a57c907f9ed28d9b6b # Parent 6169ddc827acf03049c63971f31b387253e6538d Removed the parsing for double/integer values specifying the bin width or the number of bins in DefaultHistogram, because these inserted values are no longer i18n strings (issue289). gnv-artifacts/trunk@1128 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 6169ddc827ac -r 8430269ec73b gnv-artifacts/ChangeLog --- a/gnv-artifacts/ChangeLog Wed May 26 07:00:55 2010 +0000 +++ b/gnv-artifacts/ChangeLog Wed May 26 17:01:29 2010 +0000 @@ -1,3 +1,12 @@ +2010-05-26 Ingo Weinzierl + + Issue289 + + * src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: Values + specifying the bin width or the number of bins are inserted into this + histogram as double values - no longer as i18n strings. So the complete + parsing code is removed. + 2010-05-26 Ingo Weinzierl Issue290 - PDF format of histograms depends on histograms' apsect ratio. diff -r 6169ddc827ac -r 8430269ec73b gnv-artifacts/src/main/java/de/intevation/gnv/chart/DefaultHistogram.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/DefaultHistogram.java Wed May 26 07:00:55 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/DefaultHistogram.java Wed May 26 17:01:29 2010 +0000 @@ -51,12 +51,6 @@ public static final String REQUEST_KEY_CHART_WIDTH = "width"; /** - * Default key to retrieve the Locale object from {@link - * #requestParameter} used for i18n support. - */ - public static final String REQUEST_KEY_LOCALE = "locale"; - - /** * Default key to retrieve the object from {@link #requestParameter}. It * defines which value this chart has to be used for bin calculation. You * can either adjust the number of bins or the width of a single bin. @@ -212,51 +206,18 @@ protected int getBinCountByWidth(double[] values) { int bins = -1; String param = (String) requestParameter.get(REQUEST_KEY_BIN_WIDTH); - Locale locale = (Locale) requestParameter.get(REQUEST_KEY_LOCALE); - NumberFormat format = NumberFormat.getInstance(locale); - - try { - double[] minmax = getMinMax(values); - double totalWidth = minmax[1] - minmax[0]; - Number number = format.parse(param); - double binWidth = -1d; - - if (number instanceof Double) { - binWidth = ((Double) number).doubleValue(); - } - else if (number instanceof Long) { - binWidth = ((Long) number).doubleValue(); - } - else if (number instanceof Integer) { - binWidth = ((Integer) number).doubleValue(); - } - else { - logger.warn("Invalid bin width for histogram chart: " + param); - logger.warn("Return default bins: " + DEFAULT_BINS); - return DEFAULT_BINS; - } - - double tmpBins = totalWidth / binWidth; - - bins = (int) Math.round(tmpBins); - bins = bins <= 0 ? DEFAULT_BINS : bins; - bins = bins > MAXIMAL_BINS ? MAXIMAL_BINS : bins; + double[] minmax = getMinMax(values); + double totalWidth = minmax[1] - minmax[0]; + double binWidth = Double.parseDouble(param); - return bins; - } - catch (ParseException pe) { - logger.warn("Invalid bin width for histogram chart: " + param); - logger.warn("Return default bins: " + DEFAULT_BINS); + double tmpBins = totalWidth / binWidth; - return DEFAULT_BINS; - } - catch (NumberFormatException nfe) { - logger.warn("Invalid bin width for histogram chart: " + param); - logger.warn("Return default bins: " + DEFAULT_BINS); + bins = (int) Math.round(tmpBins); + bins = bins <= 0 ? DEFAULT_BINS : bins; + bins = bins > MAXIMAL_BINS ? MAXIMAL_BINS : bins; - return DEFAULT_BINS; - } + return bins; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :