changeset 312:19fbd03544ea

Generate timeseries chart in TimeSeriesChart class instead of AbstractXYChart to instantiate special timeseries charts. gnv-artifacts/trunk@370 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 25 Nov 2009 11:41:42 +0000
parents cbb610197b9f
children 7b4e2f80cba2
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java
diffstat 2 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Wed Nov 25 09:32:00 2009 +0000
+++ b/gnv-artifacts/ChangeLog	Wed Nov 25 11:41:42 2009 +0000
@@ -1,3 +1,10 @@
+2009-11-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Override
+	  method generateChart to instantiate TimeSeries charts instead of XY
+	  charts. Before these changes, timeseries charts did not have a valid date 
+	  axis. 
+
 2009-11-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Wed Nov 25 09:32:00 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Wed Nov 25 11:41:42 2009 +0000
@@ -7,6 +7,8 @@
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.ChartTheme;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.data.general.Series;
@@ -49,6 +51,29 @@
     }
 
 
+    public JFreeChart generateChart() {
+        log.debug("generate timeseries chart");
+
+        if (chart != null)
+            return chart;
+
+        chart = ChartFactory.createTimeSeriesChart(
+            labels.getTitle(),
+            labels.getDomainAxisLabel(),
+            null,
+            null,
+            true,
+            false,
+            false
+        );
+
+        theme.apply(chart);
+        initData();
+
+        return chart;
+    }
+
+
     protected void initData() {
         log.debug("init data for timeseries chart");
 

http://dive4elements.wald.intevation.org