changeset 505:7ff916744f40

Solved issue152. Time intervals of timeseries axis are defined by JFreeChart automatically. gnv-artifacts/trunk@588 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 20 Jan 2010 17:54:48 +0000
parents efab67e68bba
children d41c155db337
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java
diffstat 2 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Wed Jan 20 16:05:52 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Wed Jan 20 17:54:48 2010 +0000
@@ -1,3 +1,12 @@
+2010-01-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+	
+	  Issue152
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Removed date
+	  formatting from timeseries charts. Set locale of DateAxis instead to
+	  localize chart axis. Advantage: JFreeChart defines intervals of axis
+	  labels automatically.
+
 2010-01-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Wed Jan 20 16:05:52 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Wed Jan 20 17:54:48 2010 +0000
@@ -7,6 +7,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
+import java.util.TimeZone;
 
 import org.apache.log4j.Logger;
 
@@ -81,6 +82,10 @@
             false,
             false
         );
+
+        XYPlot plot = (XYPlot) chart.getPlot();
+        plot.setDomainAxis(0, new DateAxis(
+            labels.getDomainAxisLabel(), TimeZone.getDefault(), locale));
     }
 
 
@@ -216,17 +221,7 @@
 
 
     protected void localizeDomainAxis(Axis axis, Locale locale) {
-        if (locale == null)
-            return;
-
-        log.debug(
-            "Set language of axis [" + axis.getLabel() + "] " +
-            "to " + locale.toString()
-        );
-
-        String dateFormat = getMessage(locale, DATE_FORMAT,DEFAULT_DATE_FORMAT);
-        DateFormat format = new SimpleDateFormat(dateFormat, locale);
-        ((DateAxis) axis).setDateFormatOverride(format);
+        // do nothing
     }
 
 

http://dive4elements.wald.intevation.org